aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/alg_id.cpp22
-rw-r--r--src/lib/asn1/asn1_attribute.cpp14
-rw-r--r--src/lib/asn1/asn1_str.cpp10
3 files changed, 13 insertions, 33 deletions
diff --git a/src/lib/asn1/alg_id.cpp b/src/lib/asn1/alg_id.cpp
index 7d476a225..75ea78c18 100644
--- a/src/lib/asn1/alg_id.cpp
+++ b/src/lib/asn1/alg_id.cpp
@@ -16,32 +16,24 @@ namespace Botan {
* Create an AlgorithmIdentifier
*/
AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
- const std::vector<byte>& param)
- {
- oid = alg_id;
- parameters = param;
- }
+ const std::vector<byte>& param) : oid(alg_id), parameters(param)
+ {}
/*
* Create an AlgorithmIdentifier
*/
AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id,
- const std::vector<byte>& param)
- {
- oid = OIDS::lookup(alg_id);
- parameters = param;
- }
+ const std::vector<byte>& param) : oid(OIDS::lookup(alg_id)), parameters(param)
+ {}
/*
* Create an AlgorithmIdentifier
*/
AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
- Encoding_Option option)
+ Encoding_Option option) : oid(alg_id), parameters()
{
const byte DER_NULL[] = { 0x05, 0x00 };
- oid = alg_id;
-
if(option == USE_NULL_PARAM)
parameters += std::pair<const byte*, size_t>(DER_NULL, sizeof(DER_NULL));
}
@@ -50,12 +42,10 @@ AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
* Create an AlgorithmIdentifier
*/
AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id,
- Encoding_Option option)
+ Encoding_Option option) : oid(OIDS::lookup(alg_id)), parameters()
{
const byte DER_NULL[] = { 0x05, 0x00 };
- oid = OIDS::lookup(alg_id);
-
if(option == USE_NULL_PARAM)
parameters += std::pair<const byte*, size_t>(DER_NULL, sizeof(DER_NULL));
}
diff --git a/src/lib/asn1/asn1_attribute.cpp b/src/lib/asn1/asn1_attribute.cpp
index 406a57d9a..bd7e5bf11 100644
--- a/src/lib/asn1/asn1_attribute.cpp
+++ b/src/lib/asn1/asn1_attribute.cpp
@@ -15,21 +15,15 @@ namespace Botan {
/*
* Create an Attribute
*/
-Attribute::Attribute(const OID& attr_oid, const std::vector<byte>& attr_value)
- {
- oid = attr_oid;
- parameters = attr_value;
- }
+Attribute::Attribute(const OID& attr_oid, const std::vector<byte>& attr_value) : oid(attr_oid), parameters(attr_value)
+ {}
/*
* Create an Attribute
*/
Attribute::Attribute(const std::string& attr_oid,
- const std::vector<byte>& attr_value)
- {
- oid = OIDS::lookup(attr_oid);
- parameters = attr_value;
- }
+ const std::vector<byte>& attr_value) : oid(OIDS::lookup(attr_oid)), parameters(attr_value)
+ {}
/*
* DER encode a Attribute
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp
index 809448888..fca0f442a 100644
--- a/src/lib/asn1/asn1_str.cpp
+++ b/src/lib/asn1/asn1_str.cpp
@@ -62,9 +62,8 @@ ASN1_Tag choose_encoding(const std::string& str,
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_tag(t)
+ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(t)
{
- m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
if(m_tag == DIRECTORY_STRING)
m_tag = choose_encoding(m_iso_8859_str, "latin1");
@@ -83,11 +82,8 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_tag(t)
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str)
- {
- m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
- m_tag = choose_encoding(m_iso_8859_str, "latin1");
- }
+ASN1_String::ASN1_String(const std::string& str) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(choose_encoding(m_iso_8859_str, "latin1"))
+ {}
/*
* Return this string in ISO 8859-1 encoding