diff options
author | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-03-30 18:27:18 +0000 |
commit | 96d6eb6f29c55e16a37cf11899547886f735b065 (patch) | |
tree | 9f13901e9b44c98d58b2589c9b09c6a7443eb7cd /src/asn1/asn1_str.cpp | |
parent | 3cc3dd72c5f87b76852a55c1f2d1821dba967d8c (diff) |
Thomas Moschny passed along a request from the Fedora packagers which came
up during the Fedora submission review, that each source file include some
text about the license. One handy Perl script later and each file now has
the line
Distributed under the terms of the Botan license
after the copyright notices.
While I was in there modifying every file anyway, I also stripped out the
remainder of the block comments (lots of astericks before and after the
text); this is stylistic thing I picked up when I was first learning C++
but in retrospect it is not a good style as the structure makes it harder
to modify comments (with the result that comments become fewer, shorter and
are less likely to be updated, which are not good things).
Diffstat (limited to 'src/asn1/asn1_str.cpp')
-rw-r--r-- | src/asn1/asn1_str.cpp | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/src/asn1/asn1_str.cpp b/src/asn1/asn1_str.cpp index bca1bf3c3..25782e239 100644 --- a/src/asn1/asn1_str.cpp +++ b/src/asn1/asn1_str.cpp @@ -1,7 +1,9 @@ -/************************************************* -* Simple ASN.1 String Types Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ +/* +* Simple ASN.1 String Types +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ #include <botan/asn1_obj.h> #include <botan/der_enc.h> @@ -13,9 +15,9 @@ namespace Botan { namespace { -/************************************************* -* Choose an encoding for the string * -*************************************************/ +/* +* Choose an encoding for the string +*/ ASN1_Tag choose_encoding(const std::string& str, const std::string& type) { @@ -57,9 +59,9 @@ ASN1_Tag choose_encoding(const std::string& str, } -/************************************************* -* Check if type is a known ASN.1 string type * -*************************************************/ +/* +* Check if type is a known ASN.1 string type +*/ bool is_string_type(ASN1_Tag tag) { if(tag == NUMERIC_STRING || tag == PRINTABLE_STRING || @@ -69,9 +71,9 @@ bool is_string_type(ASN1_Tag tag) return false; } -/************************************************* -* Create an ASN1_String * -*************************************************/ +/* +* Create an ASN1_String +*/ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t) { iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET); @@ -90,42 +92,42 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t) to_string(tag)); } -/************************************************* -* Create an ASN1_String * -*************************************************/ +/* +* Create an ASN1_String +*/ ASN1_String::ASN1_String(const std::string& str) { iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET); tag = choose_encoding(iso_8859_str, "latin1"); } -/************************************************* -* Return this string in ISO 8859-1 encoding * -*************************************************/ +/* +* Return this string in ISO 8859-1 encoding +*/ std::string ASN1_String::iso_8859() const { return iso_8859_str; } -/************************************************* -* Return this string in local encoding * -*************************************************/ +/* +* Return this string in local encoding +*/ std::string ASN1_String::value() const { return Charset::transcode(iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET); } -/************************************************* -* Return the type of this string object * -*************************************************/ +/* +* Return the type of this string object +*/ ASN1_Tag ASN1_String::tagging() const { return tag; } -/************************************************* -* DER encode an ASN1_String * -*************************************************/ +/* +* DER encode an ASN1_String +*/ void ASN1_String::encode_into(DER_Encoder& encoder) const { std::string value = iso_8859(); @@ -134,9 +136,9 @@ void ASN1_String::encode_into(DER_Encoder& encoder) const encoder.add_object(tagging(), UNIVERSAL, value); } -/************************************************* -* Decode a BER encoded ASN1_String * -*************************************************/ +/* +* Decode a BER encoded ASN1_String +*/ void ASN1_String::decode_from(BER_Decoder& source) { BER_Object obj = source.get_next_object(); |