aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ecc_key/ecc_key.cpp
diff options
context:
space:
mode:
authorsledgehammer_999 <[email protected]>2021-01-11 04:04:02 +0200
committersledgehammer_999 <[email protected]>2021-01-11 04:04:02 +0200
commitd06f04ca09b9379910f9137b4aae781404d39d5e (patch)
tree8a291bfb450fea7b600dd33296c85ce82068e99a /src/lib/pubkey/ecc_key/ecc_key.cpp
parent854b79287818a01137aa78e59e36ab10240bf13b (diff)
Split ASN1 tags enum class into 2 enum classes
This should improve type safety even more.
Diffstat (limited to 'src/lib/pubkey/ecc_key/ecc_key.cpp')
-rw-r--r--src/lib/pubkey/ecc_key/ecc_key.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/pubkey/ecc_key/ecc_key.cpp b/src/lib/pubkey/ecc_key/ecc_key.cpp
index 310c568d3..559c42dad 100644
--- a/src/lib/pubkey/ecc_key/ecc_key.cpp
+++ b/src/lib/pubkey/ecc_key/ecc_key.cpp
@@ -145,9 +145,9 @@ secure_vector<uint8_t> EC_PrivateKey::private_key_bits() const
return DER_Encoder()
.start_sequence()
.encode(static_cast<size_t>(1))
- .encode(BigInt::encode_1363(m_private_key, m_private_key.bytes()), ASN1_Tag::OCTET_STRING)
- .start_cons(ASN1_Tag(1), ASN1_Tag::PRIVATE)
- .encode(m_public_key.encode(PointGFp::Compression_Type::UNCOMPRESSED), ASN1_Tag::BIT_STRING)
+ .encode(BigInt::encode_1363(m_private_key, m_private_key.bytes()), ASN1_Type::OCTET_STRING)
+ .start_cons(ASN1_Type(1), ASN1_Class::EXPLICIT_CONTEXT_SPECIFIC)
+ .encode(m_public_key.encode(PointGFp::Compression_Type::UNCOMPRESSED), ASN1_Type::BIT_STRING)
.end_cons()
.end_cons()
.get_contents();
@@ -167,8 +167,8 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
.start_sequence()
.decode_and_check<size_t>(1, "Unknown version code for ECC key")
.decode_octet_string_bigint(m_private_key)
- .decode_optional(key_parameters, ASN1_Tag(0), ASN1_Tag::PRIVATE)
- .decode_optional_string(public_key_bits, ASN1_Tag::BIT_STRING, 1, ASN1_Tag::PRIVATE)
+ .decode_optional(key_parameters, ASN1_Type(0), ASN1_Class::EXPLICIT_CONTEXT_SPECIFIC)
+ .decode_optional_string(public_key_bits, ASN1_Type::BIT_STRING, 1, ASN1_Class::EXPLICIT_CONTEXT_SPECIFIC)
.end_cons();
if(public_key_bits.empty())