aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/ec_dompar/ec_dompar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/ec_dompar/ec_dompar.cpp')
-rw-r--r--src/pubkey/ec_dompar/ec_dompar.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pubkey/ec_dompar/ec_dompar.cpp b/src/pubkey/ec_dompar/ec_dompar.cpp
index b0aa7a87a..512d8d769 100644
--- a/src/pubkey/ec_dompar/ec_dompar.cpp
+++ b/src/pubkey/ec_dompar/ec_dompar.cpp
@@ -30,12 +30,21 @@ EC_Domain_Params::EC_Domain_Params(const OID& domain_oid)
EC_Domain_Params::EC_Domain_Params(const std::string& pem)
{
- if(pem != "")
+ if(pem == "")
+ return; // no initialization / uninitialized
+
+ try
{
DataSource_Memory input(pem);
- *this = EC_Domain_Params(
- PEM_Code::decode_check_label(input, "EC PARAMETERS"));
+ SecureVector<byte> ber =
+ PEM_Code::decode_check_label(input, "EC PARAMETERS");
+
+ *this = EC_Domain_Params(ber);
+ }
+ catch(Decoding_Error) // hmm, not PEM?
+ {
+ *this = EC_Domain_Params(OID(pem));
}
}