1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
/// Tag encoding/decoding
pub mod tag;
/// Length encoding/decoding
pub mod length;
/// The Intermediate Type
pub mod intermediate;

/// DER Trait
pub mod der;
#[doc(hidden)]
#[macro_use]
pub mod macros;

#[cfg(test)]
mod test;

pub use self::tag::*;
pub use self::length::*;
pub use self::intermediate::Intermediate;
pub use self::der::DER;

/// DER Universal Tag Values
#[derive(Debug, Copy, Clone)]
pub enum UniversalTag {
    /// End of Content
    EOC = 0,
    /// Boolean
    Boolean = 1,
    /// Integer
    Integer = 2,
    /// BitString
    BitString = 3,
    /// OctetString
    OctetString = 4,
    /// Null
    Null = 5,
    /// ObjectIdentifier
    ObjectIdentifier = 6,
    /// ObjectDescriptor
    ObjectDescriptor = 7,
    /// External
    External = 8,
    /// Real
    Real = 9,
    /// Enumerated
    Enumerated = 10,
    /// EmbeddedPDV
    EmbeddedPDV = 11,
    /// UTF8String
    UTF8String = 12,
    /// RelativeOID
    RelativeOID = 13,
    /// Reserved, Unused
    Reserved01 = 14,
    /// Reserved, Unused
    Reserved02 = 15,
    /// Sequence
    Sequence = 16,
    /// Set
    Set = 17,
    /// NumericString
    NumericString = 18,
    /// PrintableString
    PrintableString = 19,
    /// T61String
    T61String = 20,
    /// VideotexString
    VideotexString = 21,
    /// IA5String
    IA5String = 22,
    /// UTCTime
    UTCTime = 23,
    /// GeneralizedTime
    GeneralizedTime = 24,
    /// GraphicString
    GraphicString = 25,
    /// VisibleString
    VisibleString = 26,
    /// GeneralString
    GeneralString = 27,
    /// UniversalString
    UniversalString = 28,
    /// CharacterString
    CharacterString = 29,
    /// BMPString
    BMPString = 30,
}

/// DER Class Values
#[derive(PartialEq, Debug, Clone, Copy)]
pub enum Class {
    /// Universal
    Universal = 0,
    /// Application
    Application = 1,
    /// ContextSpecific
    ContextSpecific = 2,
    /// Private
    Private = 3,
}

/// DER ContentType Values
#[derive(Debug, Clone, Copy)]
pub enum ContentType {
    /// Primitive
    Primitive = 0,
    /// Constructed
    Constructed = 1,
}