Skip to main content

Crate def_oid

Crate def_oid 

Source
Expand description

§def_oid

This crate provides two procedural macros. Both macros is used to declare fixed size array of u8. The array will contains OID encoded according to ASN1 encoding scheme. See X.690 for more detail.

Two usable macros are:

  • const_oid! - This macro can be used to declare constant variable. Since Rust required that all constant must have explicit type declared and OID size required some calculation, this macro do all that. For example, OID of 2.5.4.3 is [u8; 3] while 1.1.3.4.5555 is [u8; 5]. See const_oid! for how to use it.
  • oid! - This macro can be used to declare any variable. It will return fixed size array of u8.

Macros§

const_oid
This macro is used to declare an OID (Object-Identifier) constant variable. It will automatically convert OID string into bytes array that conform to ASN1 OID encoding according to X.690 standard.
oid
This macro is used to define an OID (Object-Identifier). It will automatically convert OID string into bytes array that conform to ASN1 OID encoding according to X.690 standard.