Ocamlnet 4 Reference Manual : Netasn1.Value

# Module Netasn1.Value

    module Value: sig .. end

    type pc =

`|` | `Primitive`
`|` | `Constructed`

    type value =

`|` | `Bool of `bool``
`|` | `Integer of `int_value``
`|` | `Enum of `int_value``
`|` | `Real of `real_value``
`|` | `Bitstring of `bitstring_value``
`|` | `Octetstring of `string``
`|` | `Null`
`|` | `Seq of `value list``
`|` | `Set of `value list``
`|` | `Tagptr of `tag_class * int * pc * string * int * int``
`|` | `Tag of `tag_class * int * pc * value``
`|` | `OID of `int array``
`|` | `ROID of `int array``
`|` | `ObjectDescriptor of `string``
`|` | `External of `value list``
`|` | `Embedded_PDV of `value list``
`|` | `NumericString of `string``
`|` | `PrintableString of `string``
`|` | `TeletexString of `string``
`|` | `VideotexString of `string``
`|` | `VisibleString of `string``
`|` | `IA5String of `string``
`|` | `GraphicString of `string``
`|` | `GeneralString of `string``
`|` | `UniversalString of `string``
`|` | `BMPString of `string``
`|` | `UTF8String of `string``
`|` | `CharString of `string``
`|` | `UTCTime of `time_value``
`|` | `GeneralizedTime of `time_value``

    type tag_class =

`|` | `Universal`
`|` | `Application`
`|` | `Context`
`|` | `Private`

    type int_value

    type real_value

    type bitstring_value

    type time_value

    val get_int_str : int_value -> string

Get an integer as bytes

    val get_int_b256 : int_value -> int array

Get an integer in base 256 notation, big endian. Negative values are represented using two's complement (i.e. the first array element is >= 128). The empty array means 0.

    val get_int : int_value -> int

Get an integer as `int` if representable, or raise `Out_of_range`

    val get_int32 : int_value -> int32

Get an integer as `int32` if representable, or raise `Out_of_range`

    val get_int64 : int_value -> int64

Get an integer as `int64` if representable, or raise `Out_of_range`

    val get_real_str : real_value -> string

Get the byte representation of the real

    val get_bitstring_size : bitstring_value -> int

Get the number of bits

    val get_bitstring_data : bitstring_value -> string

Get the data. The last byte may be partial. The order of the bits in every byte: bit 7 (MSB) contains the first bit

    val get_bitstring_bits : bitstring_value -> bool array

Get the bitstring as bool array

    val get_time_str : time_value -> string

Get the raw time string

    val get_time : time_value -> Netdate.t

Get the time. Notes:

- UTCTime years are two-digit years, and interpreted so that 0-49 is understood as 2000-2049, and 50-99 is understood as 1950-1999 (as required by X.509).
- `get_time_nsec` returns the fractional part as nanoseconds. Higher resolutions than that are truncated.
- This function is restricted to the time formats occurring in DER

    val equal : value -> value -> bool

Checks for equality. Notes:

- `Tag` and `Tagptr` are considered different
- `Tagptr` is checked by comparing the equality of the substring
- `Set` is so far not compared as set, but as sequence (i.e. order matters)