Ocamlnet 4 Reference Manual : Netsys_crypto_types.PUBKEY_CRYPTO

# Module type Netsys_crypto_types.PUBKEY_CRYPTO

    module type PUBKEY_CRYPTO = sig .. end

    type public_key

    type private_key

    type pin_callback

    type algorithm

    val supported_x509 : int array list

The supported X509 algorithm types as list of OIDs

    val algorithm_x509 : int array -> string option -> algorithm

The algorithm is specified by OID. The parameters - if present - are DER-encoded. The passed parameters override any parameters already contained in the key. Usually, it is only necessary to provide parameters that are not yet contained in the key (e.g. the hash algorithms of RSASSA-PSS when applied to a normal RSA key).

    val import_public_key_x509 : string -> public_key

The DER-encoded subjectPublicKeyInfo

    val import_public_key_uri : string -> public_key

indirect reference e.g. a PKCS11 URI

    val import_public_key_uri_with_pin : pin_callback ->
           string -> public_key

    type x509_private_key = string * string

`(format,data)`, using the formats: "RSA", "DSA", "DH", "EC". The `data` is DER-encoded.

    val import_private_key_x509 : x509_private_key ->
           private_key

import a private key from DER

    val import_private_key_uri : string -> private_key

indirect reference e.g. a PKCS11 URI

    val import_private_key_uri_with_pin : pin_callback ->
           string -> private_key

    val import_public_key_from_private : private_key ->
           public_key

    val simple_pin_callback : (unit -> string) -> pin_callback

    val encrypt : algorithm ->
           public_key -> string -> string

    val decrypt : algorithm ->
           private_key -> string -> string

    val verify : algorithm ->
           public_key -> string -> string -> bool

    val sign : algorithm ->
           private_key -> string -> string