aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-19 01:18:40 -0500
committerJack Lloyd <[email protected]>2017-12-19 01:33:40 -0500
commitafabd4a6b33336815614288f01b80bcbf31ba79c (patch)
treebae42c4560c37f8090f6658eefc45bac77eb7b13 /src/lib/pubkey
parentac754772afbf7be397f8631ebbb3d2921b0a7753 (diff)
Add accessors to ASN1_Attribute and AlgorithmIdentifier
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/dl_algo/dl_algo.cpp4
-rw-r--r--src/lib/pubkey/ecc_key/ecc_key.cpp4
-rw-r--r--src/lib/pubkey/gost_3410/gost_3410.cpp2
-rw-r--r--src/lib/pubkey/pbes2/pbes2.cpp12
-rw-r--r--src/lib/pubkey/pk_algs.cpp8
-rw-r--r--src/lib/pubkey/pkcs8.cpp12
6 files changed, 21 insertions, 21 deletions
diff --git a/src/lib/pubkey/dl_algo/dl_algo.cpp b/src/lib/pubkey/dl_algo/dl_algo.cpp
index 4f0e38e9f..c28ccaee0 100644
--- a/src/lib/pubkey/dl_algo/dl_algo.cpp
+++ b/src/lib/pubkey/dl_algo/dl_algo.cpp
@@ -38,7 +38,7 @@ DL_Scheme_PublicKey::DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id,
const std::vector<uint8_t>& key_bits,
DL_Group::Format format)
{
- m_group.BER_decode(alg_id.parameters, format);
+ m_group.BER_decode(alg_id.get_parameters(), format);
BER_Decoder(key_bits).decode(m_y);
}
@@ -52,7 +52,7 @@ DL_Scheme_PrivateKey::DL_Scheme_PrivateKey(const AlgorithmIdentifier& alg_id,
const secure_vector<uint8_t>& key_bits,
DL_Group::Format format)
{
- m_group.BER_decode(alg_id.parameters, format);
+ m_group.BER_decode(alg_id.get_parameters(), format);
BER_Decoder(key_bits).decode(m_x);
}
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index 962cd3f45..442fb41d2 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -41,7 +41,7 @@ EC_PublicKey::EC_PublicKey(const EC_Group& dom_par,
EC_PublicKey::EC_PublicKey(const AlgorithmIdentifier& alg_id,
const std::vector<uint8_t>& key_bits) :
- m_domain_params{EC_Group(alg_id.parameters)},
+ m_domain_params{EC_Group(alg_id.get_parameters())},
m_public_key{OS2ECP(key_bits, domain().get_curve())}
{
if (!domain().get_oid().empty())
@@ -162,7 +162,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
const secure_vector<uint8_t>& key_bits,
bool with_modular_inverse)
{
- m_domain_params = EC_Group(alg_id.parameters);
+ m_domain_params = EC_Group(alg_id.get_parameters());
m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT;
OID key_parameters;
diff --git a/src/lib/pubkey/gost_3410/gost_3410.cpp b/src/lib/pubkey/gost_3410/gost_3410.cpp
index 324b7e985..acd127a2d 100644
--- a/src/lib/pubkey/gost_3410/gost_3410.cpp
+++ b/src/lib/pubkey/gost_3410/gost_3410.cpp
@@ -54,7 +54,7 @@ GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id,
OID ecc_param_id;
// The parameters also includes hash and cipher OIDs
- BER_Decoder(alg_id.parameters).start_cons(SEQUENCE).decode(ecc_param_id);
+ BER_Decoder(alg_id.get_parameters()).start_cons(SEQUENCE).decode(ecc_param_id);
m_domain_params = EC_Group(ecc_param_id);
diff --git a/src/lib/pubkey/pbes2/pbes2.cpp b/src/lib/pubkey/pbes2/pbes2.cpp
index 41d18a86d..65e2cb429 100644
--- a/src/lib/pubkey/pbes2/pbes2.cpp
+++ b/src/lib/pubkey/pbes2/pbes2.cpp
@@ -174,14 +174,14 @@ pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
AlgorithmIdentifier prf_algo;
- if(kdf_algo.oid != OIDS::lookup("PKCS5.PBKDF2"))
+ if(kdf_algo.get_oid() != OIDS::lookup("PKCS5.PBKDF2"))
throw Decoding_Error("PBE-PKCS5 v2.0: Unknown KDF algorithm " +
- kdf_algo.oid.as_string());
+ kdf_algo.get_oid().as_string());
secure_vector<uint8_t> salt;
size_t iterations = 0, key_length = 0;
- BER_Decoder(kdf_algo.parameters)
+ BER_Decoder(kdf_algo.get_parameters())
.start_cons(SEQUENCE)
.decode(salt, OCTET_STRING)
.decode(iterations)
@@ -191,7 +191,7 @@ pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
AlgorithmIdentifier::USE_NULL_PARAM))
.end_cons();
- const std::string cipher = OIDS::lookup(enc_algo.oid);
+ const std::string cipher = OIDS::lookup(enc_algo.get_oid());
const std::vector<std::string> cipher_spec = split_on(cipher, '/');
if(cipher_spec.size() != 2)
throw Decoding_Error("PBE-PKCS5 v2.0: Invalid cipher spec " + cipher);
@@ -202,9 +202,9 @@ pbes2_decrypt(const secure_vector<uint8_t>& key_bits,
throw Decoding_Error("PBE-PKCS5 v2.0: Encoded salt is too small");
secure_vector<uint8_t> iv;
- BER_Decoder(enc_algo.parameters).decode(iv, OCTET_STRING).verify_end();
+ BER_Decoder(enc_algo.get_parameters()).decode(iv, OCTET_STRING).verify_end();
- const std::string prf = OIDS::lookup(prf_algo.oid);
+ const std::string prf = OIDS::lookup(prf_algo.get_oid());
std::unique_ptr<PBKDF> pbkdf(get_pbkdf("PBKDF2(" + prf + ")"));
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp
index e2009ce0e..d34c59ccf 100644
--- a/src/lib/pubkey/pk_algs.cpp
+++ b/src/lib/pubkey/pk_algs.cpp
@@ -84,10 +84,10 @@ std::unique_ptr<Public_Key>
load_public_key(const AlgorithmIdentifier& alg_id,
const std::vector<uint8_t>& key_bits)
{
- const std::vector<std::string> alg_info = split_on(OIDS::lookup(alg_id.oid), '/');
+ const std::vector<std::string> alg_info = split_on(OIDS::lookup(alg_id.get_oid()), '/');
if(alg_info.empty())
- throw Decoding_Error("Unknown algorithm OID: " + alg_id.oid.as_string());
+ throw Decoding_Error("Unknown algorithm OID: " + alg_id.get_oid().as_string());
const std::string alg_name = alg_info[0];
@@ -170,9 +170,9 @@ std::unique_ptr<Private_Key>
load_private_key(const AlgorithmIdentifier& alg_id,
const secure_vector<uint8_t>& key_bits)
{
- const std::string alg_name = OIDS::lookup(alg_id.oid);
+ const std::string alg_name = OIDS::lookup(alg_id.get_oid());
if(alg_name == "")
- throw Decoding_Error("Unknown algorithm OID: " + alg_id.oid.as_string());
+ throw Decoding_Error("Unknown algorithm OID: " + alg_id.get_oid().as_string());
#if defined(BOTAN_HAS_RSA)
if(alg_name == "RSA")
diff --git a/src/lib/pubkey/pkcs8.cpp b/src/lib/pubkey/pkcs8.cpp
index fe2470275..0d13d8090 100644
--- a/src/lib/pubkey/pkcs8.cpp
+++ b/src/lib/pubkey/pkcs8.cpp
@@ -101,9 +101,9 @@ secure_vector<uint8_t> PKCS8_decode(
{
if(is_encrypted)
{
- if(OIDS::lookup(pbe_alg_id.oid) != "PBE-PKCS5v20")
- throw Exception("Unknown PBE type " + pbe_alg_id.oid.as_string());
- key = pbes2_decrypt(key_data, get_passphrase(), pbe_alg_id.parameters);
+ if(OIDS::lookup(pbe_alg_id.get_oid()) != "PBE-PKCS5v20")
+ throw Exception("Unknown PBE type " + pbe_alg_id.get_oid().as_string());
+ key = pbes2_decrypt(key_data, get_passphrase(), pbe_alg_id.get_parameters());
}
else
key = key_data;
@@ -298,10 +298,10 @@ load_key(DataSource& source,
AlgorithmIdentifier alg_id;
secure_vector<uint8_t> pkcs8_key = PKCS8_decode(source, get_pass, alg_id, is_encrypted);
- const std::string alg_name = OIDS::lookup(alg_id.oid);
- if(alg_name.empty() || alg_name == alg_id.oid.as_string())
+ const std::string alg_name = OIDS::lookup(alg_id.get_oid());
+ if(alg_name.empty() || alg_name == alg_id.get_oid().as_string())
throw PKCS8_Exception("Unknown algorithm OID: " +
- alg_id.oid.as_string());
+ alg_id.get_oid().as_string());
return load_private_key(alg_id, pkcs8_key);
}