Crypto++
8.0
Free C++ class library of cryptographic schemes
|
Classes and functions for working with ANS.1 objects. More...
Go to the source code of this file.
Classes | |
class | UnknownOID |
Exception thrown when an unknown object identifier is encountered. More... | |
class | OID |
Object Identifier. More... | |
class | EncodedObjectFilter |
ASN.1 encoded object filter. More... | |
class | BERGeneralDecoder |
BER General Decoder. More... | |
class | DERGeneralEncoder |
DER General Encoder. More... | |
class | BERSequenceDecoder |
BER Sequence Decoder. More... | |
class | DERSequenceEncoder |
DER Sequence Encoder. More... | |
class | BERSetDecoder |
BER Set Decoder. More... | |
class | DERSetEncoder |
DER Set Encoder. More... | |
class | ASNOptional< T > |
Optional data encoder and decoder. More... | |
class | ASN1CryptoMaterial< BASE > |
Encode and decode ASN.1 objects with additional information. More... | |
class | X509PublicKey |
Encodes and decodes subjectPublicKeyInfo. More... | |
class | PKCS8PrivateKey |
Encodes and Decodes privateKeyInfo. More... | |
Enumerations | |
enum | ASNTag { BOOLEAN = 0x01, INTEGER = 0x02, BIT_STRING = 0x03, OCTET_STRING = 0x04, TAG_NULL = 0x05, OBJECT_IDENTIFIER = 0x06, OBJECT_DESCRIPTOR = 0x07, EXTERNAL = 0x08, REAL = 0x09, ENUMERATED = 0x0a, UTF8_STRING = 0x0c, SEQUENCE = 0x10, SET = 0x11, NUMERIC_STRING = 0x12, PRINTABLE_STRING = 0x13, T61_STRING = 0x14, VIDEOTEXT_STRING = 0x15, IA5_STRING = 0x16, UTC_TIME = 0x17, GENERALIZED_TIME = 0x18, GRAPHIC_STRING = 0x19, VISIBLE_STRING = 0x1a, GENERAL_STRING = 0x1b } |
ASN.1 types. More... | |
enum | ASNIdFlag { UNIVERSAL = 0x00, PRIMITIVE = 0x00, CONSTRUCTED = 0x20, APPLICATION = 0x40, CONTEXT_SPECIFIC = 0x80, PRIVATE = 0xc0 } |
ASN.1 flags. More... | |
Functions | |
void | BERDecodeError () |
Raises a BERDecodeErr. | |
size_t | DERLengthEncode (BufferedTransformation &bt, lword length) |
DER encode a length. More... | |
bool | BERLengthDecode (BufferedTransformation &bt, size_t &length) |
BER decode a length. More... | |
void | DEREncodeNull (BufferedTransformation &bt) |
DER encode NULL. More... | |
void | BERDecodeNull (BufferedTransformation &bt) |
BER decode NULL. More... | |
size_t | DEREncodeOctetString (BufferedTransformation &bt, const byte *str, size_t strLen) |
DER encode octet string. More... | |
size_t | DEREncodeOctetString (BufferedTransformation &bt, const SecByteBlock &str) |
DER encode octet string. More... | |
size_t | BERDecodeOctetString (BufferedTransformation &bt, SecByteBlock &str) |
BER decode octet string. More... | |
size_t | BERDecodeOctetString (BufferedTransformation &bt, BufferedTransformation &str) |
BER decode octet string. More... | |
size_t | DEREncodeTextString (BufferedTransformation &bt, const std::string &str, byte asnTag) |
DER encode text string. More... | |
size_t | BERDecodeTextString (BufferedTransformation &bt, std::string &str, byte asnTag) |
BER decode text string. More... | |
size_t | DEREncodeBitString (BufferedTransformation &bt, const byte *str, size_t strLen, unsigned int unusedBits=0) |
DER encode bit string. More... | |
size_t | BERDecodeBitString (BufferedTransformation &bt, SecByteBlock &str, unsigned int &unusedBits) |
DER decode bit string. More... | |
void | DERReencode (BufferedTransformation &bt, BufferedTransformation &dest) |
BER decode and DER re-encode. More... | |
template<class T > | |
size_t | DEREncodeUnsigned (BufferedTransformation &out, T w, byte asnTag=INTEGER) |
DER Encode unsigned value. More... | |
template<class T > | |
void | BERDecodeUnsigned (BufferedTransformation &in, T &w, byte asnTag=INTEGER, T minValue=0, T maxValue=T(0xffffffff)) |
BER Decode unsigned value. More... | |
bool | operator== (const OID &lhs, const OID &rhs) |
Compare two OIDs for equality. More... | |
bool | operator!= (const OID &lhs, const OID &rhs) |
Compare two OIDs for inequality. More... | |
bool | operator< (const OID &lhs, const OID &rhs) |
Compare two OIDs for ordering. More... | |
OID | operator+ (const OID &lhs, unsigned long rhs) |
Append a value to an OID. More... | |
Classes and functions for working with ANS.1 objects.
Definition in file asn.h.
enum ASNTag |
enum ASNIdFlag |
size_t DERLengthEncode | ( | BufferedTransformation & | bt, |
lword | length | ||
) |
DER encode a length.
bt | BufferedTransformation object for writing |
length | the size to encode |
DER encode a length.
bool BERLengthDecode | ( | BufferedTransformation & | bt, |
size_t & | length | ||
) |
BER decode a length.
bt | BufferedTransformation object for reading |
length | the decoded size |
BERDecodeError | if the value fails to decode or is too large for size_t |
BERLengthDecode() returns false if the encoding is indefinite length.
void DEREncodeNull | ( | BufferedTransformation & | bt | ) |
DER encode NULL.
bt | BufferedTransformation object for writing |
void BERDecodeNull | ( | BufferedTransformation & | bt | ) |
BER decode NULL.
bt | BufferedTransformation object for reading |
size_t DEREncodeOctetString | ( | BufferedTransformation & | bt, |
const byte * | str, | ||
size_t | strLen | ||
) |
DER encode octet string.
bt | BufferedTransformation object for writing |
str | the string to encode |
strLen | the length of the string |
DER encode octet string.
size_t DEREncodeOctetString | ( | BufferedTransformation & | bt, |
const SecByteBlock & | str | ||
) |
DER encode octet string.
bt | BufferedTransformation object for reading |
str | the string to encode |
size_t BERDecodeOctetString | ( | BufferedTransformation & | bt, |
SecByteBlock & | str | ||
) |
BER decode octet string.
bt | BufferedTransformation object for reading |
str | the decoded string |
size_t BERDecodeOctetString | ( | BufferedTransformation & | bt, |
BufferedTransformation & | str | ||
) |
BER decode octet string.
bt | BufferedTransformation object for reading |
str | the decoded string |
size_t DEREncodeTextString | ( | BufferedTransformation & | bt, |
const std::string & | str, | ||
byte | asnTag | ||
) |
DER encode text string.
bt | BufferedTransformation object for writing |
str | the string to encode |
asnTag | the ASN.1 type |
DEREncodeTextString() can be used for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING
size_t BERDecodeTextString | ( | BufferedTransformation & | bt, |
std::string & | str, | ||
byte | asnTag | ||
) |
BER decode text string.
bt | BufferedTransformation object for reading |
str | the string to encode |
asnTag | the ASN.1 type |
DEREncodeTextString() can be used for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING
size_t DEREncodeBitString | ( | BufferedTransformation & | bt, |
const byte * | str, | ||
size_t | strLen, | ||
unsigned int | unusedBits | ||
) |
DER encode bit string.
bt | BufferedTransformation object for writing |
str | the string to encode |
strLen | the length of the string |
unusedBits | the number of unused bits |
DER encode bit string.
size_t BERDecodeBitString | ( | BufferedTransformation & | bt, |
SecByteBlock & | str, | ||
unsigned int & | unusedBits | ||
) |
DER decode bit string.
bt | BufferedTransformation object for reading |
str | the decoded string |
unusedBits | the number of unused bits |
void DERReencode | ( | BufferedTransformation & | bt, |
BufferedTransformation & | dest | ||
) |
BER decode and DER re-encode.
bt | BufferedTransformation object for writing |
dest | BufferedTransformation object |
size_t DEREncodeUnsigned | ( | BufferedTransformation & | out, |
T | w, | ||
byte | asnTag = INTEGER |
||
) |
DER Encode unsigned value.
T | class or type |
out | BufferedTransformation object |
w | unsigned value to encode |
asnTag | the ASN.1 type |
DEREncodeUnsigned() can be used with INTEGER, BOOLEAN, and ENUM
void BERDecodeUnsigned | ( | BufferedTransformation & | in, |
T & | w, | ||
byte | asnTag = INTEGER , |
||
T | minValue = 0 , |
||
T | maxValue = T(0xffffffff) |
||
) |
BER Decode unsigned value.
T | fundamental C++ type |
in | BufferedTransformation object |
w | the decoded value |
asnTag | the ASN.1 type |
minValue | the minimum expected value |
maxValue | the maximum expected value |
BERDecodeErr() | if the value cannot be parsed or the decoded value is not within range. |
DEREncodeUnsigned() can be used with INTEGER, BOOLEAN, and ENUM
Compare two OIDs for ordering.
operator<() calls std::lexicographical_compare() on each element in the array of values.