Fabcoin Core  0.16.2
P2P Digital Currency
Functions
asn.cpp File Reference
#include "pch.h"
#include "config.h"
#include "asn.h"
#include <iomanip>
#include <time.h>
Include dependency graph for asn.cpp:

Go to the source code of this file.

Functions

size_t DERLengthEncode (BufferedTransformation &bt, lword length)
 DER Length. More...
 
bool BERLengthDecode (BufferedTransformation &bt, lword &length, bool &definiteLength)
 
bool BERLengthDecode (BufferedTransformation &bt, size_t &length)
 BER decode a length. More...
 
void DEREncodeNull (BufferedTransformation &out)
 DER encode NULL. More...
 
void BERDecodeNull (BufferedTransformation &in)
 BER decode NULL. More...
 
size_t DEREncodeOctetString (BufferedTransformation &bt, const byte *str, size_t strLen)
 ASN Strings. 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)
 ASN BitString. More...
 
size_t BERDecodeBitString (BufferedTransformation &bt, SecByteBlock &str, unsigned int &unusedBits)
 DER decode bit string. More...
 
void DERReencode (BufferedTransformation &source, BufferedTransformation &dest)
 BER decode and DER re-encode. More...
 

Function Documentation

size_t 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 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:

size_t 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:

size_t 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:

size_t 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:

bool BERLengthDecode ( BufferedTransformation bt,
lword length,
bool &  definiteLength 
)

Definition at line 38 of file asn.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool 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:

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

ASN BitString.

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:

void 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:

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

ASN Strings.

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:

size_t 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:

size_t 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:

size_t DERLengthEncode ( BufferedTransformation bt,
lword  length 
)

DER Length.

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:

void DERReencode ( BufferedTransformation bt,
BufferedTransformation dest 
)

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: