Botan  2.4.0
Crypto and TLS for C++11
Public Member Functions | Protected Member Functions | List of all members
Botan::ASN1_Formatter Class Referenceabstract

#include <asn1_print.h>

Inheritance diagram for Botan::ASN1_Formatter:

Public Member Functions

 ASN1_Formatter (bool print_context_specific)
std::string print (const uint8_t in[], size_t len) const
template<typename Alloc >
std::string print (const std::vector< uint8_t, Alloc > &vec) const
void print_to_stream (std::ostream &out, const uint8_t in[], size_t len) const
virtual ~ASN1_Formatter ()=default

Protected Member Functions

virtual std::string format (ASN1_Tag type_tag, ASN1_Tag class_tag, size_t level, size_t length, const std::string &value) const =0
virtual std::string format_bin (ASN1_Tag type_tag, ASN1_Tag class_tag, const std::vector< uint8_t > &vec) const =0

Detailed Description

Format ASN.1 data and call a virtual to format

Definition at line 22 of file asn1_print.h.

Constructor & Destructor Documentation

◆ ~ASN1_Formatter()

virtual Botan::ASN1_Formatter::~ASN1_Formatter ( )

◆ ASN1_Formatter()

Botan::ASN1_Formatter::ASN1_Formatter ( bool  print_context_specific)
print_context_specificif true, try to parse nested context specific data.

Definition at line 30 of file asn1_print.h.

30  :
31  m_print_context_specific(print_context_specific)
32  {}

Member Function Documentation

◆ format()

virtual std::string Botan::ASN1_Formatter::format ( ASN1_Tag  type_tag,
ASN1_Tag  class_tag,
size_t  level,
size_t  length,
const std::string &  value 
) const
protectedpure virtual

This is called for each element

Referenced by print_to_stream().

◆ format_bin()

virtual std::string Botan::ASN1_Formatter::format_bin ( ASN1_Tag  type_tag,
ASN1_Tag  class_tag,
const std::vector< uint8_t > &  vec 
) const
protectedpure virtual

This is called to format binary elements that we don't know how to convert to a string The result will be passed as value to format; the tags are included as a hint to aid decoding.

Referenced by print_to_stream().

◆ print() [1/2]

std::string Botan::ASN1_Formatter::print ( const uint8_t  in[],
size_t  len 
) const

Definition at line 59 of file asn1_print.cpp.

References print_to_stream().

60  {
61  std::ostringstream output;
62  print_to_stream(output, in, len);
63  return output.str();
64  }
void print_to_stream(std::ostream &out, const uint8_t in[], size_t len) const
Definition: asn1_print.cpp:66

◆ print() [2/2]

template<typename Alloc >
std::string Botan::ASN1_Formatter::print ( const std::vector< uint8_t, Alloc > &  vec) const

Definition at line 41 of file asn1_print.h.

References Botan::PEM_Code::decode().

42  {
43  return print(, vec.size());
44  }
std::string print(const uint8_t in[], size_t len) const
Definition: asn1_print.cpp:59

◆ print_to_stream()

void Botan::ASN1_Formatter::print_to_stream ( std::ostream &  out,
const uint8_t  in[],
size_t  len 
) const

The documentation for this class was generated from the following files: