diff options
author | lloyd <[email protected]> | 2010-03-01 23:21:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-01 23:21:52 +0000 |
commit | 6bcac1c845ecd7ae82fd83b1085015710b7c2a72 (patch) | |
tree | 676d3908e669a59f68296adb70bdf7d81f57bbd2 | |
parent | febcffc5b0430566600018efbc8608b1df3a54d8 (diff) |
Add EC domain contructor eating PEM. Set OID in OID constructor
-rw-r--r-- | src/pubkey/ec_dompar/ec_dompar.cpp | 14 | ||||
-rw-r--r-- | src/pubkey/ec_dompar/ec_dompar.h | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/pubkey/ec_dompar/ec_dompar.cpp b/src/pubkey/ec_dompar/ec_dompar.cpp index 6f284332a..a9fd055b7 100644 --- a/src/pubkey/ec_dompar/ec_dompar.cpp +++ b/src/pubkey/ec_dompar/ec_dompar.cpp @@ -429,9 +429,9 @@ std::vector<std::string> get_standard_domain_parameter(const OID& oid) } -EC_Domain_Params::EC_Domain_Params(const OID& oid) +EC_Domain_Params::EC_Domain_Params(const OID& domain_oid) { - std::vector<std::string> dom_par = get_standard_domain_parameter(oid); + std::vector<std::string> dom_par = get_standard_domain_parameter(domain_oid); BigInt p(dom_par[0]); // give as 0x... BigInt a(dom_par[1]); @@ -446,6 +446,15 @@ EC_Domain_Params::EC_Domain_Params(const OID& oid) curve = CurveGFp(p, a, b); base_point = OS2ECP(sv_g, curve); + oid = domain_oid.as_string(); + } + +EC_Domain_Params::EC_Domain_Params(const std::string& pem) + { + DataSource_Memory input(pem); + + *this = EC_Domain_Params( + PEM_Code::decode_check_label(input, "ECC DOMAIN PARAMETERS")); } EC_Domain_Params::EC_Domain_Params(const MemoryRegion<byte>& ber_data) @@ -547,4 +556,3 @@ std::string EC_Domain_Params::PEM_encode() const } } - diff --git a/src/pubkey/ec_dompar/ec_dompar.h b/src/pubkey/ec_dompar/ec_dompar.h index 8700cf158..f1e386796 100644 --- a/src/pubkey/ec_dompar/ec_dompar.h +++ b/src/pubkey/ec_dompar/ec_dompar.h @@ -63,6 +63,12 @@ class BOTAN_DLL EC_Domain_Params EC_Domain_Params(const OID& oid); /** + * Create an EC domain from PEM encoding (as from PEM_encode) + * @param pem data + */ + EC_Domain_Params(const std::string& pem); + + /** * Create the DER encoding of this domain * @param form of encoding to use * @returns bytes encododed as DER |