Botan  1.11.15
Public Member Functions | Protected Member Functions
Botan::ASN1_Car Class Reference

#include <eac_asn_obj.h>

Inheritance diagram for Botan::ASN1_Car:
Botan::ASN1_EAC_String Botan::ASN1_Object

List of all members.

Public Member Functions

 ASN1_Car (std::string const &str="")
void decode_from (class BER_Decoder &)
void encode_into (class DER_Encoder &) const
std::string iso_8859 () const
ASN1_Tag tagging () const
std::string value () const

Protected Member Functions

bool sanity_check () const

Detailed Description

This class represents CARs of CVCs. (String tagged with 2)

Definition at line 198 of file eac_asn_obj.h.


Constructor & Destructor Documentation

Botan::ASN1_Car::ASN1_Car ( std::string const &  str = "")

Create a CAR with the specified content.

Parameters:
strthe CAR value

Definition at line 119 of file asn1_eac_str.cpp.

   : ASN1_EAC_String(str, ASN1_Tag(2))
   {}

Member Function Documentation

void Botan::ASN1_EAC_String::decode_from ( class BER_Decoder from) [virtual, inherited]

Decode whatever this object is from from

Parameters:
fromthe BER_Decoder that will be read from

Implements Botan::ASN1_Object.

Definition at line 66 of file asn1_eac_str.cpp.

References Botan::ASN1_EAC_String::ASN1_EAC_String(), Botan::BER_Decoder::get_next_object(), Botan::LATIN1_CHARSET, Botan::LOCAL_CHARSET, Botan::ASN1::to_string(), Botan::Charset::transcode(), and Botan::BER_Object::type_tag.

   {
   BER_Object obj = source.get_next_object();

   if(obj.type_tag != this->tag)
      {
      std::stringstream ss;

      ss << "ASN1_EAC_String tag mismatch, tag was "
         << std::hex << obj.type_tag
         << " expected "
         << std::hex << this->tag;

      throw Decoding_Error(ss.str());
      }

   Character_Set charset_is;
   charset_is = LATIN1_CHARSET;

   try
      {
      *this = ASN1_EAC_String(
         Charset::transcode(ASN1::to_string(obj), charset_is, LOCAL_CHARSET),
         obj.type_tag);
      }
   catch(Invalid_Argument& inv_arg)
      {
      throw Decoding_Error(std::string("ASN1_EAC_String decoding failed: ") +
                           inv_arg.what());
      }
   }
void Botan::ASN1_EAC_String::encode_into ( class DER_Encoder to) const [virtual, inherited]

Encode whatever this object is into to

Parameters:
tothe DER_Encoder that will be written to

Implements Botan::ASN1_Object.

Definition at line 57 of file asn1_eac_str.cpp.

References Botan::DER_Encoder::add_object(), Botan::APPLICATION, Botan::ASN1_EAC_String::iso_8859(), Botan::ASN1_EAC_String::tagging(), and Botan::ASN1_EAC_String::value().

   {
   std::string value = iso_8859();
   encoder.add_object(tagging(), APPLICATION, value);
   }
std::string Botan::ASN1_EAC_String::iso_8859 ( ) const [inherited]

Get this objects string value.

Returns:
string value in iso8859 encoding

Definition at line 33 of file asn1_eac_str.cpp.

Referenced by Botan::ASN1_EAC_String::encode_into(), Botan::operator==(), and Botan::DE_EAC::sign_request().

   {
   return iso_8859_str;
   }
bool Botan::ASN1_EAC_String::sanity_check ( ) const [protected, inherited]

Definition at line 100 of file asn1_eac_str.cpp.

Referenced by Botan::ASN1_EAC_String::ASN1_EAC_String().

   {
   const byte* rep = reinterpret_cast<const byte*>(iso_8859_str.data());
   const size_t rep_len = iso_8859_str.size();

   for(size_t i = 0; i != rep_len; ++i)
      {
      if((rep[i] < 0x20) || ((rep[i] >= 0x7F) && (rep[i] < 0xA0)))
         return false;
      }

   return true;
   }

Definition at line 49 of file asn1_eac_str.cpp.

Referenced by Botan::ASN1_EAC_String::encode_into().

   {
   return tag;
   }
std::string Botan::ASN1_EAC_String::value ( ) const [inherited]

Get this objects string value.

Returns:
string value

Definition at line 41 of file asn1_eac_str.cpp.

References Botan::LATIN1_CHARSET, Botan::LOCAL_CHARSET, and Botan::Charset::transcode().

Referenced by Botan::CVC_EAC::create_self_signed_cert(), Botan::ASN1_EAC_String::encode_into(), and Botan::DE_EAC::sign_request().

   {
   return Charset::transcode(iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET);
   }

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