package tls-async

  1. Overview
  2. Docs

Public keys

The type for public keys

The polymorphic variant of public keys, with PKCS 8 encoding and decoding to PEM.

Operations on public keys

val pp : t Fmt.t

pp ppf pub pretty-prints the public key pub on ppf.

val id : t -> string

id public_key is digest, the 160-bit `SHA1 hash of the BIT STRING subjectPublicKey (excluding tag, length, and number of unused bits) for publicKeyInfo of public_key.

RFC 5280, 4.2.1.2, variant (1)

val fingerprint : ?hash:Digestif.hash' -> t -> string

fingerprint ?hash public_key is digest, the hash (by default SHA256) of the DER encoded public key (equivalent to openssl x509 -noout -pubkey | openssl pkey -pubin -outform DER | openssl dgst -HASH).

val key_type : t -> X509.Key_type.t

key_type public_key is its key_type.

Cryptographic verify operation

Decoding and encoding in ASN.1 DER and PEM format

val encode_der : t -> string

encode_der pk is buffer, the ASN.1 encoding of the given public key.

val encode_pem : t -> string

encode_pem public_key is pem, the pem encoded public key.

val verify : Digestif.hash' -> ?scheme:Key_type.signature_scheme -> signature:string -> t -> [ `Digest of string | `Message of string ] -> unit Core.Or_error.t
val decode_der : contents:string -> t Core.Or_error.t
val decode_pem : contents:string -> t Core.Or_error.t
OCaml

Innovation. Community. Security.