type attribute =
| CN of string |
| Serialnumber of string |
| C of string |
| L of string |
| ST of string |
| O of string |
| OU of string |
| T of string |
| DNQ of string |
| Mail of string |
| DC of string |
| Given_name of string |
| Surname of string |
| Initials of string |
| Pseudonym of string |
| Generation of string |
| Street of string |
| Userid of string |
| Other of Asn.oid * string |
The variant of a relative distinguished name component, as defined in X.500: an attribute type and value.
module Relative_distinguished_name : Stdlib.Set.S with type elt = attribute
Relative_distinguished_name is a set of attributes.
type t = Relative_distinguished_name.t list
A distinguished name is a list of relative distinguished names, starting with the most significant component.
val make_pp : format:[ `RFC4514 | `OpenSSL | `OSF ] -> ?spacing:[ `Tight | `Medium | `Loose ] -> unit -> t Fmt.t
make_pp ()
creates a customized pretty-printer for t
.
- parameter format
Determines RDN order, escaping rules, and the default spacing:
`RFC4514
produces the RFC4514. RDNs are written in reverse order of the ASN.1 representation and spacing defaults to tight.`OpenSSL
produces the a format similar to OpenSSL. RDNs are written in the order of the ASN.1 representation, and spacing defaults to loose.`OSF
emits RDNs in the order they occur in the ASN.1 representation, each prefixed by a slashes, using tight spacing. This format is designed by analogy to RFC4514, substituting slash for comma an semicolon, and may currently not be fully compliant with the OSF specifications.
- parameter spacing
Determines whether to add space around separators:
`Tight
to not add any redundant space,`Medium
to add space after comma and around plus signs, and`Loose
to also add space around equality signs.
This parameter is currently ignored for the OSF format.
The pretty-printer can be wrapped in a box to control line breaking and set it apart, otherwise the RDN components will flow with the surrounding text.
pp ppf dn
pretty-prints the distinguished name. This is currently Fmt.hbox (make_pp ~format:`OSF ())
. If your application relies on the precise format, it is advicable to create a custom formatter with make_pp
to guard against future changes to the default format.
val common_name : t -> string option
common_name t
is Some x
if the distinguished name t
contains a CN x
, None
otherwise.
val decode_der : Cstruct.t -> (t, [> Rresult.R.msg ]) Rresult.result
decode_der cs
is dn
, the ASN.1 decoded distinguished name of cs
.