Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Enumerations | Functions
asn.h File Reference

Classes and functions for working with ANS.1 objects. More...

#include "cryptlib.h"
#include "filters.h"
#include "smartptr.h"
#include "stdcpp.h"
#include "queue.h"
#include "misc.h"
Include dependency graph for asn.h:
This graph shows which files directly or indirectly include this file:

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 decodesprivateKeyInfo. 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. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API DERLengthEncode (BufferedTransformation &bt, lword length)
 DER encode a length. More...
 
CRYPTOPP_DLL bool CRYPTOPP_API BERLengthDecode (BufferedTransformation &bt, size_t &length)
 BER decode a length. More...
 
CRYPTOPP_DLL void CRYPTOPP_API DEREncodeNull (BufferedTransformation &bt)
 DER encode NULL. More...
 
CRYPTOPP_DLL void CRYPTOPP_API BERDecodeNull (BufferedTransformation &bt)
 BER decode NULL. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString (BufferedTransformation &bt, const byte *str, size_t strLen)
 DER encode octet string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString (BufferedTransformation &bt, const SecByteBlock &str)
 DER encode octet string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString (BufferedTransformation &bt, SecByteBlock &str)
 BER decode octet string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString (BufferedTransformation &bt, BufferedTransformation &str)
 BER decode octet string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeTextString (BufferedTransformation &bt, const std::string &str, byte asnTag)
 DER encode text string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeTextString (BufferedTransformation &bt, std::string &str, byte asnTag)
 BER decode text string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeBitString (BufferedTransformation &bt, const byte *str, size_t strLen, unsigned int unusedBits=0)
 DER encode bit string. More...
 
CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeBitString (BufferedTransformation &bt, SecByteBlock &str, unsigned int &unusedBits)
 DER decode bit string. More...
 
CRYPTOPP_DLL void CRYPTOPP_API 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 ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
 
bool operator!= (const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
 
bool operator< (const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
 
inline::CryptoPP::OID operator+ (const ::CryptoPP::OID &lhs, unsigned long rhs)
 

Detailed Description

Classes and functions for working with ANS.1 objects.

Definition in file asn.h.

Enumeration Type Documentation

enum ASNIdFlag

ASN.1 flags.

Note
These tags and flags are not complete
Enumerator
UNIVERSAL 
PRIMITIVE 
CONSTRUCTED 
APPLICATION 
CONTEXT_SPECIFIC 
PRIVATE 

Definition at line 56 of file asn.h.

enum ASNTag

ASN.1 types.

Note
These tags and flags are not complete
Enumerator
BOOLEAN 
INTEGER 
BIT_STRING 
OCTET_STRING 
TAG_NULL 
OBJECT_IDENTIFIER 
OBJECT_DESCRIPTOR 
EXTERNAL 
REAL 
ENUMERATED 
UTF8_STRING 
SEQUENCE 
SET 
NUMERIC_STRING 
PRINTABLE_STRING 
T61_STRING 
VIDEOTEXT_STRING 
IA5_STRING 
UTC_TIME 
GENERALIZED_TIME 
GRAPHIC_STRING 
VISIBLE_STRING 
GENERAL_STRING 

Definition at line 27 of file asn.h.

Function Documentation

CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeBitString ( BufferedTransformation bt,
SecByteBlock str,
unsigned int &  unusedBits 
)

DER decode bit string.

Parameters
btBufferedTransformation object for reading
strthe decoded string
unusedBitsthe number of unused bits

Definition at line 188 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void BERDecodeError ( )
inline

Raises a BERDecodeErr.

Definition at line 69 of file asn.h.

Here is the caller graph for this function:

CRYPTOPP_DLL void CRYPTOPP_API BERDecodeNull ( BufferedTransformation bt)

BER decode NULL.

Parameters
btBufferedTransformation object for reading

Definition at line 93 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString ( BufferedTransformation bt,
SecByteBlock str 
)

BER decode octet string.

Parameters
btBufferedTransformation object for reading
strthe decoded string
Returns
the number of octets used for the encoding

Definition at line 117 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeOctetString ( BufferedTransformation bt,
BufferedTransformation str 
)

BER decode octet string.

Parameters
btBufferedTransformation object for reading
strthe decoded string
Returns
the number of octets used for the encoding

Definition at line 135 of file asn.cpp.

Here is the call graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API BERDecodeTextString ( BufferedTransformation bt,
std::string &  str,
byte  asnTag 
)

BER decode text string.

Parameters
btBufferedTransformation object for reading
strthe string to encode
asnTagthe ASN.1 type

DEREncodeTextString() can be used for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING

Definition at line 159 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
void BERDecodeUnsigned ( BufferedTransformation in,
T w,
byte  asnTag = INTEGER,
T  minValue = 0,
T  maxValue = T(0xffffffff) 
)

BER Decode unsigned value.

Template Parameters
Tfundamental C++ type
Parameters
inBufferedTransformation object
wthe decoded value
asnTagthe ASN.1 type
minValuethe minimum expected value
maxValuethe maximum expected value
Exceptions
BERDecodeErr()if the value cannot be parsed or the decoded value is not within range.

DEREncodeUnsigned() can be used with INTEGER, BOOLEAN, and ENUM

Definition at line 491 of file asn.h.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL bool CRYPTOPP_API BERLengthDecode ( BufferedTransformation bt,
size_t &  length 
)

BER decode a length.

Parameters
btBufferedTransformation object for reading
lengththe decoded size
Returns
true if the value was decoded
Exceptions
BERDecodeErrorif the value fails to decode or is too large for size_t

BERLengthDecode() returns false if the encoding is indefinite length.

Definition at line 76 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeBitString ( BufferedTransformation bt,
const byte str,
size_t  strLen,
unsigned int  unusedBits 
)

DER encode bit string.

Parameters
btBufferedTransformation object for writing
strthe string to encode
strLenthe length of the string
unusedBitsthe number of unused bits
Returns
the number of octets used for the encoding

DER encode bit string.

Definition at line 179 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL void CRYPTOPP_API DEREncodeNull ( BufferedTransformation bt)

DER encode NULL.

Parameters
btBufferedTransformation object for writing

Definition at line 87 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString ( BufferedTransformation bt,
const byte str,
size_t  strLen 
)

DER encode octet string.

Parameters
btBufferedTransformation object for writing
strthe string to encode
strLenthe length of the string
Returns
the number of octets used for the encoding

DER encode octet string.

Definition at line 104 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeOctetString ( BufferedTransformation bt,
const SecByteBlock str 
)

DER encode octet string.

Parameters
btBufferedTransformation object for reading
strthe string to encode
Returns
the number of octets used for the encoding

Definition at line 112 of file asn.cpp.

Here is the call graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API DEREncodeTextString ( BufferedTransformation bt,
const std::string &  str,
byte  asnTag 
)

DER encode text string.

Parameters
btBufferedTransformation object for writing
strthe string to encode
asnTagthe ASN.1 type
Returns
the number of octets used for the encoding

DEREncodeTextString() can be used for UTF8_STRING, PRINTABLE_STRING, and IA5_STRING

Definition at line 151 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
size_t DEREncodeUnsigned ( BufferedTransformation out,
T  w,
byte  asnTag = INTEGER 
)

DER Encode unsigned value.

Template Parameters
Tclass or type
Parameters
outBufferedTransformation object
wunsigned value to encode
asnTagthe ASN.1 type

DEREncodeUnsigned() can be used with INTEGER, BOOLEAN, and ENUM

Definition at line 455 of file asn.h.

Here is the call graph for this function:

Here is the caller graph for this function:

CRYPTOPP_DLL size_t CRYPTOPP_API DERLengthEncode ( BufferedTransformation bt,
lword  length 
)

DER encode a length.

Parameters
btBufferedTransformation object for writing
lengththe size to encode
Returns
the number of octets used for the encoding

DER encode a length.

Definition at line 17 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

BER decode and DER re-encode.

Parameters
btBufferedTransformation object for writing
destBufferedTransformation object

Definition at line 213 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool operator!= ( const ::CryptoPP::OID &  lhs,
const ::CryptoPP::OID &  rhs 
)
inline

Definition at line 560 of file asn.h.

Here is the caller graph for this function:

inline ::CryptoPP::OID operator+ ( const ::CryptoPP::OID &  lhs,
unsigned long  rhs 
)

Definition at line 564 of file asn.h.

Here is the caller graph for this function:

bool operator< ( const ::CryptoPP::OID &  lhs,
const ::CryptoPP::OID &  rhs 
)
inline

Definition at line 562 of file asn.h.

Here is the caller graph for this function:

bool operator== ( const ::CryptoPP::OID &  lhs,
const ::CryptoPP::OID &  rhs 
)
inline

Definition at line 558 of file asn.h.

Here is the caller graph for this function: