DER document.
More...
#include <der.h>
|
static BasePtr | parse_element (const std::vector< uint8_t > &, size_t=0) |
| Parse an element from a data vector. More...
|
|
static BasePtr | parse_element (const std::vector< char > &v, size_t idx=0) |
|
static void | dump_element (const BasePtr &, std::vector< uint8_t > &) |
| Dump an element to a data vector. More...
|
|
static void | dump_element (const BasePtr &b, std::vector< char > &v) |
|
static std::string | print_element (const BasePtr &, bool=false, const std::string &=" |") |
| Print an element and any sub-elements to a string. More...
|
|
|
void | parse_bin () |
|
void | dump_bin () |
|
DER document.
Binary document using the ASN.1 DER subset.
This assumes ownership of any DerBase object set to the root element.
Specification: https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
- Examples
- scclib/crypto/unittest/der.cc, and scclib/crypto/unittest/der_cert.cc.
Definition at line 823 of file der.h.
◆ dump() [1/2]
void DerDocument::dump |
( |
std::ostream & |
s | ) |
|
|
virtual |
◆ dump() [2/2]
void DerDocument::dump |
( |
std::vector< char > & |
vout | ) |
|
|
virtual |
◆ dump_element()
void DerDocument::dump_element |
( |
const BasePtr & |
base, |
|
|
std::vector< uint8_t > & |
vout |
|
) |
| |
|
static |
Dump an element to a data vector.
Null element produces no data.
Data is appended to the vector.
Definition at line 1231 of file der.cc.
◆ parse() [1/2]
void DerDocument::parse |
( |
const std::vector< char > & |
v | ) |
|
|
virtual |
Parse a buffer from a binary DER-formatted vector.
Binary data is reset.
Parsing an empty vector results in an empty document.
Reimplemented in scc::crypto::PemDocument.
Definition at line 1217 of file der.cc.
◆ parse() [2/2]
void DerDocument::parse |
( |
std::istream & |
s | ) |
|
|
virtual |
◆ parse_element()
BasePtr DerDocument::parse_element |
( |
const std::vector< uint8_t > & |
binv, |
|
|
size_t |
off = 0 |
|
) |
| |
|
static |
Parse an element from a data vector.
- Parameters
-
binv | Binary vector to parse. |
off | Offset into vector. |
Parse error, empty or invalid input data throws an exception.
Parses elements and fills containers. Returns the root element parsed.
Definition at line 1171 of file der.cc.
◆ print_element()
std::string DerDocument::print_element |
( |
const BasePtr & |
base, |
|
|
bool |
debug = false , |
|
|
const std::string & |
indent = " |" |
|
) |
| |
|
static |
Print an element and any sub-elements to a string.
Empty base pointer produces "<null>" output.
- Parameters
-
base | Base element. |
debug | Print debugging offset information. |
indent | Indentation string, printed once per sublevel. |
Container elements print an indentation string, then a delimiter string, before all sub-elements
Definition at line 1336 of file der.cc.
◆ root()
Root DerBase.
Throws exception if document is empty.
Definition at line 1297 of file der.cc.
◆ root_ptr()
BasePtr scc::crypto::DerDocument::root_ptr |
( |
| ) |
const |
|
inline |
Return the root pointer.
May be null if document is empty.
Definition at line 936 of file der.h.
◆ str()
std::string DerDocument::str |
( |
bool |
debug = false | ) |
const |
Debug string dump.
- Parameters
-
debug | Print document and element offset and size information. |
Returns <null> string if document is empty.
Definition at line 1347 of file der.cc.
The documentation for this class was generated from the following files: