|
Botan 3.13.0
Crypto and TLS for C&
|
#include <asn1_obj.h>
Public Member Functions | |
| ASN1_String (std::string_view utf8, ASN1_Type tag) | |
| ASN1_String (std::string_view utf8="") | |
| std::vector< uint8_t > | BER_encode () const |
| void | decode_from (BER_Decoder &from) override |
| bool | empty () const |
| void | encode_into (DER_Encoder &to) const override |
| bool | operator== (const ASN1_String &other) const |
| size_t | size () const |
| ASN1_Type | tagging () const |
| const std::string & | value () const |
Static Public Member Functions | |
| static bool | is_string_type (ASN1_Type tag) |
Friends | |
| bool | operator< (const ASN1_String &a, const ASN1_String &b) |
ASN.1 string type This class normalizes all inputs to a UTF-8 std::string
Definition at line 577 of file asn1_obj.h.
|
explicit |
Create a string, tagged as PrintableString if possible and otherwise as Utf8String
| utf8 | the value of the string, encoded as UTF-8 |
Definition at line 145 of file asn1_str.cpp.
References ASN1_String().
Referenced by ASN1_String(), operator<, and operator==().
| Botan::ASN1_String::ASN1_String | ( | std::string_view | utf8, |
| ASN1_Type | tag ) |
Create a string with a specific type tag
| utf8 | the value of the string, encoded as UTF-8 |
| tag | the string type tag to encode this value with |
Throws Invalid_Argument if tag is not a string type that is a subset of UTF-8, or if utf8 is not a valid value for that type.
Definition at line 135 of file asn1_str.cpp.
References Botan::asn1_tag_to_string(), and Botan::fmt().
|
inherited |
Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.
Definition at line 21 of file asn1_obj.cpp.
References encode_into().
Referenced by decode_from(), Botan::PKCS12::export_to(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::PEM_encode(), and Botan::PSS_Params::PSS_Params().
|
overridevirtual |
Decode whatever this object is from from
| from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 162 of file asn1_str.cpp.
References Botan::asn1_tag_to_string(), Botan::BER_Object::bits(), Botan::BmpString, Botan::fmt(), Botan::BER_Object::get_class(), Botan::BER_Decoder::get_next_object(), Botan::latin1_to_utf8(), Botan::BER_Object::length(), Botan::TeletexString, Botan::ASN1::to_string(), Botan::BER_Object::type(), Botan::ucs2_to_utf8(), Botan::ucs4_to_utf8(), Botan::Universal, and Botan::UniversalString.
|
inline |
Return true if this string is empty
Definition at line 600 of file asn1_obj.h.
Referenced by Botan::X509_DN::add_attribute().
|
overridevirtual |
Encode whatever this object is into to
| to | the DER_Encoder that will be written to |
Implements Botan::ASN1_Object.
Definition at line 150 of file asn1_str.cpp.
References Botan::DER_Encoder::add_object(), tagging(), and Botan::Universal.
|
static |
Return true iff this is a tag for a known string type we can handle.
Definition at line 131 of file asn1_str.cpp.
Referenced by Botan::AlternativeName::decode_from().
|
inline |
Compare two strings, ignoring the type tag they were encoded with
Definition at line 610 of file asn1_obj.h.
References ASN1_String(), and value().
|
inline |
Return the length in bytes of the UTF-8 representation of this string
Definition at line 595 of file asn1_obj.h.
References value().
|
inline |
Return the string type tag this value was encoded with
Definition at line 585 of file asn1_obj.h.
Referenced by encode_into().
|
inline |
Return the value of this string, converted to UTF-8
Definition at line 590 of file asn1_obj.h.
Referenced by Botan::Cert_Extension::TNAuthList::Entry::decode_from(), Botan::AlternativeName::encode_into(), Botan::GeneralName::encode_into(), Botan::X509_DN::get_first_attribute(), operator<, operator==(), Botan::TLS::Session::Session(), and size().
|
friend |
Definition at line 612 of file asn1_obj.h.
References ASN1_String(), and value().