From dd4984b39fb4d5e43cc9ba97f7180b0780c04217 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 2 Mar 2010 00:26:39 +0000 Subject: Set PEM constructor (taking a string) to default to "". In this case, don't initialize. --- src/pubkey/ec_dompar/ec_dompar.cpp | 16 +++++++++++----- src/pubkey/ec_dompar/ec_dompar.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pubkey/ec_dompar/ec_dompar.cpp b/src/pubkey/ec_dompar/ec_dompar.cpp index 544257552..7910e898f 100644 --- a/src/pubkey/ec_dompar/ec_dompar.cpp +++ b/src/pubkey/ec_dompar/ec_dompar.cpp @@ -25,14 +25,18 @@ EC_Domain_Params::EC_Domain_Params(const OID& domain_oid) throw Lookup_Error("No ECC domain data for " + domain_oid.as_string()); *this = EC_Domain_Params(pem); + oid = domain_oid.as_string(); } EC_Domain_Params::EC_Domain_Params(const std::string& pem) { - DataSource_Memory input(pem); + if(pem != "") + { + DataSource_Memory input(pem); - *this = EC_Domain_Params( - PEM_Code::decode_check_label(input, "ECC DOMAIN PARAMETERS")); + *this = EC_Domain_Params( + PEM_Code::decode_check_label(input, "ECC DOMAIN PARAMETERS")); + } } EC_Domain_Params::EC_Domain_Params(const MemoryRegion& ber_data) @@ -110,8 +114,10 @@ EC_Domain_Params::DER_encode(EC_Domain_Params_Encoding form) const .encode(curve.get_p()) .end_cons() .start_cons(SEQUENCE) - .encode(BigInt::encode_1363(curve.get_a(), p_bytes), OCTET_STRING) - .encode(BigInt::encode_1363(curve.get_b(), p_bytes), OCTET_STRING) + .encode(BigInt::encode_1363(curve.get_a(), p_bytes), + OCTET_STRING) + .encode(BigInt::encode_1363(curve.get_b(), p_bytes), + OCTET_STRING) .end_cons() .encode(EC2OSP(base_point, PointGFp::UNCOMPRESSED), OCTET_STRING) .encode(order) diff --git a/src/pubkey/ec_dompar/ec_dompar.h b/src/pubkey/ec_dompar/ec_dompar.h index e063389ca..6789976d0 100644 --- a/src/pubkey/ec_dompar/ec_dompar.h +++ b/src/pubkey/ec_dompar/ec_dompar.h @@ -63,7 +63,7 @@ class BOTAN_DLL EC_Domain_Params * Create an EC domain from PEM encoding (as from PEM_encode) * @param pem data */ - EC_Domain_Params(const std::string& pem); + EC_Domain_Params(const std::string& pem = ""); /** * Create the DER encoding of this domain -- cgit v1.2.3