diff options
Diffstat (limited to 'src/pubkey/ec_dompar/ec_dompar.cpp')
-rw-r--r-- | src/pubkey/ec_dompar/ec_dompar.cpp | 15 |
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)); } } |