aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/ecc_key/ecc_key.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/ecc_key/ecc_key.cpp')
-rw-r--r--src/pubkey/ecc_key/ecc_key.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp
index 2f98eb691..8e1f40665 100644
--- a/src/pubkey/ecc_key/ecc_key.cpp
+++ b/src/pubkey/ecc_key/ecc_key.cpp
@@ -57,6 +57,23 @@ void EC_PublicKey::X509_load_hook()
}
}
+EC_PublicKey::EC_PublicKey(const AlgorithmIdentifier& alg_id,
+ const MemoryRegion<byte>& key_bits)
+ {
+ domain_params = EC_Domain_Params(alg_id.parameters);
+
+ public_key = PointGFp(OS2ECP(key_bits, domain().get_curve()));
+
+ try
+ {
+ public_point().check_invariants();
+ }
+ catch(Illegal_Point)
+ {
+ throw Decoding_Error("Invalid public point; not on curve");
+ }
+ }
+
X509_Decoder* EC_PublicKey::x509_decoder()
{
class EC_Key_Decoder : public X509_Decoder