aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/ec_dompar/ec_dompar.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-04-19 23:20:41 +0000
committerlloyd <[email protected]>2010-04-19 23:20:41 +0000
commit358a943a1772bb491983a3f227bf03dc861dbf76 (patch)
treed93f564051e0976df7ac35921aeb45b33ceebf1e /src/pubkey/ec_dompar/ec_dompar.cpp
parent90de8014d379f1f81b57cabc9a6a52a548ff262a (diff)
In the string constructor of EC_Domain_Params, check if the PEM decoding
failed. If so, assume the input string was an OID and try that.
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));
}
}