Module Sm2Source

Sourcetype scalar
Sourcetype point
Sourcetype private_key = {
  1. private_scalar : scalar;
  2. public_point : point;
}
Sourcetype key_exchange_role = [
  1. | `Initiator
  2. | `Responder
]
Sourcetype key_exchange_result = {
  1. shared_key : string;
  2. confirmation_in : string;
  3. confirmation_out : string;
}
Sourceval scalar_of_hex : string -> scalar
Sourceval scalar_to_hex : scalar -> string
Sourceval point_of_hex : x:string -> y:string -> point
Sourceval point_to_hex : point -> string * string
Sourceval derive_public_key : scalar -> point
Sourceval za : id:string -> point -> string
Sourceval digest_for_sign : id:string -> point -> string -> string
Sourceval sign_digest : k:scalar -> priv:scalar -> digest:string -> scalar * scalar
Sourceval verify_digest : pub:point -> digest:string -> signature:(scalar * scalar) -> bool
Sourceval encrypt : k:scalar -> pub:point -> string -> string
Sourceval decrypt : priv:scalar -> string -> string option
Sourceval private_key_of_scalar : scalar -> private_key
Sourceval ephemeral_public_key : scalar -> point
Sourceval key_exchange : role:key_exchange_role -> self_id:string -> self_static:private_key -> self_ephemeral:scalar -> peer_id:string -> peer_static:point -> peer_ephemeral:point -> key_length:int -> key_exchange_result option
Sourceval encode_signature_der : (scalar * scalar) -> string
Sourceval decode_signature_der : string -> (scalar * scalar) option
Sourceval encode_private_key_sec1_der : private_key -> string
Sourceval decode_private_key_sec1_der : string -> private_key option
Sourceval encode_private_key_pkcs8_der : private_key -> string
Sourceval decode_private_key_pkcs8_der : string -> private_key option
Sourceval encode_public_key_der : point -> string
Sourceval decode_public_key_der : string -> point option
Sourceval encode_private_key_pem : [ `Sec1 | `Pkcs8 ] -> private_key -> string
Sourceval decode_private_key_pem : string -> private_key option
Sourceval encode_private_key_encrypted_pem : password:string -> salt:bytes -> iv:bytes -> iterations:int -> private_key -> string
Sourceval decode_private_key_encrypted_pem : password:string -> string -> private_key option
Sourceval encode_public_key_pem : point -> string
Sourceval decode_public_key_pem : string -> point option