package pkcs11-driver

  1. Overview
  2. Docs

High-level PKCS#11 bindings.

exception CKR of P11.RV.t
module type S = sig ... end
type t = (module S)
val initialize : t -> unit
val finalize : t -> unit
val get_info : t -> P11.Info.t
val get_slot : t -> P11.Slot.t -> (P11.Slot_id.t, string) Stdlib.result
val get_slot_list : t -> bool -> P11.Slot_id.t list
val get_slot_info : t -> slot:P11.Slot_id.t -> P11.Slot_info.t
val get_token_info : t -> slot:P11.Slot_id.t -> P11.Token_info.t
val get_mechanism_list : t -> slot:P11.Slot_id.t -> P11.Mechanism_type.t list
val get_mechanism_info : t -> slot:P11.Slot_id.t -> P11.Mechanism_type.t -> P11.Mechanism_info.t
val init_token : t -> slot:P11.Slot_id.t -> pin:string -> label:string -> unit
val init_PIN : t -> P11.Session_handle.t -> pin:string -> unit
val set_PIN : t -> P11.Session_handle.t -> oldpin:string -> newpin:string -> unit
val open_session : t -> slot:P11.Slot_id.t -> flags:P11.Flags.t -> P11.Session_handle.t
val close_session : t -> P11.Session_handle.t -> unit
val close_all_sessions : t -> slot:P11.Slot_id.t -> unit
val get_session_info : t -> P11.Session_handle.t -> P11.Session_info.t
val login : t -> P11.Session_handle.t -> P11.User_type.t -> string -> unit
val logout : t -> P11.Session_handle.t -> unit
val destroy_object : t -> P11.Session_handle.t -> P11.Object_handle.t -> unit
val get_attribute_value_optimized : t -> P11.Attribute_types.t -> [ `Optimized of P11.Session_handle.t -> P11.Object_handle.t -> P11.Template.t ]
val set_attribute_value : t -> P11.Session_handle.t -> P11.Object_handle.t -> P11.Template.t -> unit
val find_objects : t -> ?max_size:int -> P11.Session_handle.t -> P11.Template.t -> P11.Object_handle.t list
val multipart_encrypt_init : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> unit
val multipart_encrypt_chunck : t -> P11.Session_handle.t -> P11.Data.t -> P11.Data.t
val multipart_encrypt_final : t -> P11.Session_handle.t -> P11.Data.t
val multipart_decrypt_init : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> unit
val multipart_decrypt_chunck : t -> P11.Session_handle.t -> P11.Data.t -> P11.Data.t
val multipart_decrypt_final : t -> P11.Session_handle.t -> P11.Data.t
val multipart_sign_init : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> unit
val multipart_sign_chunck : t -> P11.Session_handle.t -> P11.Data.t -> unit
val multipart_sign_final : t -> P11.Session_handle.t -> P11.Data.t
val verify : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> data:P11.Data.t -> signature:P11.Data.t -> unit
val verify_recover : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> signature:P11.Data.t -> P11.Data.t
val multipart_verify_init : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> unit
val multipart_verify_chunck : t -> P11.Session_handle.t -> P11.Data.t -> unit
val multipart_verify_final : t -> P11.Session_handle.t -> P11.Data.t -> unit
val multipart_verify : t -> P11.Session_handle.t -> P11.Mechanism.t -> P11.Object_handle.t -> P11.Data.t list -> P11.Data.t -> unit
module Make (X : Pkcs11.RAW) : S
val load_driver : ?log_calls:(string * Stdlib.Format.formatter) -> ?on_unknown:(string -> unit) -> ?load_mode:P11.Load_mode.t -> string -> t

May raise Pkcs11.Cannot_load_module. on_unknown will be called with a warning message when unsupported codes are encountered.

OCaml

Innovation. Community. Security.