diff options
author | lloyd <[email protected]> | 2010-03-01 23:05:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-01 23:05:00 +0000 |
commit | 3fb831f2e24ec1e3d7f8902d4aa5adceaf366f01 (patch) | |
tree | 226c329e44047b418add41e3ddfc58c322229409 /checks | |
parent | b789c87b7c96dbdb00839996c9603a3f0921b25b (diff) |
Kill get_EC_Dom_Pars_by_oid
Diffstat (limited to 'checks')
-rw-r--r-- | checks/cvc_tests.cpp | 18 | ||||
-rw-r--r-- | checks/ec_tests.cpp | 14 | ||||
-rw-r--r-- | checks/ecdsa.cpp | 13 | ||||
-rw-r--r-- | checks/eckaeg.cpp | 7 | ||||
-rw-r--r-- | checks/pk_bench.cpp | 6 | ||||
-rw-r--r-- | checks/x509.cpp | 2 |
6 files changed, 32 insertions, 28 deletions
diff --git a/checks/cvc_tests.cpp b/checks/cvc_tests.cpp index 454ed0b36..5a88a5535 100644 --- a/checks/cvc_tests.cpp +++ b/checks/cvc_tests.cpp @@ -91,7 +91,7 @@ void test_enc_gen_selfsigned(RandomNumberGenerator& rng) opts.hash_alg = "SHA-256"; // creating a non sense selfsigned cert w/o dom pars - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.11")); + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.11")); ECDSA_PrivateKey key(rng, dom_pars); key.set_parameter_encoding(EC_DOMPAR_ENC_IMPLICITCA); EAC1_1_CVC cert = CVC_EAC::create_self_signed_cert(key, opts, rng); @@ -201,7 +201,7 @@ void test_enc_gen_req(RandomNumberGenerator& rng) opts.hash_alg = "SHA-160"; // creating a non sense selfsigned cert w/o dom pars - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); ECDSA_PrivateKey key(rng, dom_pars); key.set_parameter_encoding(EC_DOMPAR_ENC_IMPLICITCA); EAC1_1_Req req = CVC_EAC::create_cvc_req(key, opts.chr, opts.hash_alg, rng); @@ -226,7 +226,7 @@ void test_cvc_req_ext(RandomNumberGenerator&) std::cout << "." << std::flush; EAC1_1_Req req_in(TEST_DATA_DIR "/DE1_flen_chars_cvcRequest_ECDSA.der"); - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.5")); // "german curve" + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.5")); // "german curve" //req_in.set_domain_parameters(dom_pars); std::auto_ptr<Public_Key> p_pk = req_in.subject_public_key(); ECDSA_PublicKey* p_ecdsa_pk = dynamic_cast<ECDSA_PublicKey*>(p_pk.get()); @@ -241,7 +241,7 @@ void test_cvc_ado_ext(RandomNumberGenerator&) std::cout << "." << std::flush; EAC1_1_ADO req_in(TEST_DATA_DIR "/ado.cvcreq"); - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.5")); // "german curve" + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.5")); // "german curve" //cout << "car = " << req_in.get_car().value() << std::endl; //req_in.set_domain_parameters(dom_pars); } @@ -256,7 +256,7 @@ void test_cvc_ado_creation(RandomNumberGenerator& rng) opts.hash_alg = "SHA-256"; // creating a non sense selfsigned cert w/o dom pars - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.11")); + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.11")); //cout << "mod = " << hex << dom_pars.get_curve().get_p() << std::endl; ECDSA_PrivateKey req_key(rng, dom_pars); req_key.set_parameter_encoding(EC_DOMPAR_ENC_IMPLICITCA); @@ -300,7 +300,7 @@ void test_cvc_ado_comparison(RandomNumberGenerator& rng) opts.hash_alg = "SHA-224"; // creating a non sense selfsigned cert w/o dom pars - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.11")); + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.11")); ECDSA_PrivateKey req_key(rng, dom_pars); req_key.set_parameter_encoding(EC_DOMPAR_ENC_IMPLICITCA); //EAC1_1_Req req = CVC_EAC::create_cvc_req(req_key, opts); @@ -421,14 +421,14 @@ void test_copy_and_assignment(RandomNumberGenerator&) CHECK(cert_in == cert_ass); EAC1_1_ADO ado_in(TEST_DATA_DIR "/ado.cvcreq"); - //EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.5")); // "german curve" + //EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.5")); // "german curve" EAC1_1_ADO ado_cp(ado_in); EAC1_1_ADO ado_ass = ado_in; CHECK(ado_in == ado_cp); CHECK(ado_in == ado_ass); EAC1_1_Req req_in(TEST_DATA_DIR "/DE1_flen_chars_cvcRequest_ECDSA.der"); - //EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.5")); // "german curve" + //EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.5")); // "german curve" EAC1_1_Req req_cp(req_in); EAC1_1_Req req_ass = req_in; CHECK(req_in == req_cp); @@ -489,7 +489,7 @@ void test_cvc_chain(RandomNumberGenerator& rng) { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.36.3.3.2.8.1.1.5")); // "german curve" + EC_Domain_Params dom_pars(OID("1.3.36.3.3.2.8.1.1.5")); // "german curve" ECDSA_PrivateKey cvca_privk(rng, dom_pars); std::string hash("SHA-224"); ASN1_Car car("DECVCA00001"); diff --git a/checks/ec_tests.cpp b/checks/ec_tests.cpp index 0c814a136..ce3ff1195 100644 --- a/checks/ec_tests.cpp +++ b/checks/ec_tests.cpp @@ -186,7 +186,7 @@ void test_point_transformation () // get a vailid point - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); PointGFp p = dom_pars.get_base_point(); // get a copy @@ -706,7 +706,7 @@ void test_gfp_store_restore() // generate point //EC_Domain_Params dom_pars = global_config().get_ec_dompar("1.3.132.0.8"); //EC_Domain_Params dom_pars("1.3.132.0.8"); - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); PointGFp p = dom_pars.get_base_point(); //store point (to std::string) @@ -792,9 +792,7 @@ void test_mult_by_order() std::cout << "." << std::flush; // generate point - //EC_Domain_Params dom_pars = global_config().get_ec_dompar("1.3.132.0.8"); - //EC_Domain_Params dom_pars("1.3.132.0.8"); - EC_Domain_Params dom_pars = get_EC_Dom_Pars_by_oid("1.3.132.0.8"); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); PointGFp p = dom_pars.get_base_point(); PointGFp shouldBeZero = p * dom_pars.get_order(); @@ -805,7 +803,7 @@ void test_point_swap(RandomNumberGenerator& rng) { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); PointGFp a(create_random_point(rng, dom_pars.get_curve())); PointGFp b(create_random_point(rng, dom_pars.get_curve())); @@ -826,7 +824,7 @@ void test_point_swap(RandomNumberGenerator& rng) void test_mult_sec_mass(RandomNumberGenerator& rng) { - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); for(int i = 0; i<50; i++) { std::cout << "." << std::flush; @@ -845,7 +843,7 @@ void test_curve_cp_ctor() { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); CurveGFp curve(dom_pars.get_curve()); } diff --git a/checks/ecdsa.cpp b/checks/ecdsa.cpp index f9dcf5597..d76994937 100644 --- a/checks/ecdsa.cpp +++ b/checks/ecdsa.cpp @@ -47,7 +47,7 @@ void test_hash_larger_than_n(RandomNumberGenerator& rng) { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); // n: // 0x0100000000000000000001f4c8f927aed3ca752257 // 21 bytes // -> shouldn't work with SHA224 which outputs 23 bytes @@ -124,7 +124,7 @@ void test_message_larger_than_n(RandomNumberGenerator& rng) { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); ECDSA_PrivateKey priv_key(rng, dom_pars); std::string str_message = ("12345678901234567890abcdef1212345678901234567890abcdef1212345678901234567890abcdef12"); @@ -219,7 +219,7 @@ bool test_ec_sign(RandomNumberGenerator& rng) try { - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); ECDSA_PrivateKey priv_key(rng, dom_pars); std::string pem_encoded_key = PKCS8::PEM_encode(priv_key); @@ -283,7 +283,7 @@ void test_create_pkcs8(RandomNumberGenerator& rng) std::ofstream rsa_priv_key(TEST_DATA_DIR "/rsa_private.pkcs8.pem"); rsa_priv_key << PKCS8::PEM_encode(rsa_key); - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); ECDSA_PrivateKey key(rng, dom_pars); // later used by other tests :( @@ -300,7 +300,7 @@ void test_create_and_verify(RandomNumberGenerator& rng) { std::cout << "." << std::flush; - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid("1.3.132.0.8")); + EC_Domain_Params dom_pars(OID("1.3.132.0.8")); ECDSA_PrivateKey key(rng, dom_pars); std::ofstream priv_key(TEST_DATA_DIR "/dompar_private.pkcs8.pem"); priv_key << PKCS8::PEM_encode(key); @@ -389,7 +389,8 @@ void test_curve_registry(RandomNumberGenerator& rng) try { - EC_Domain_Params dom_pars(get_EC_Dom_Pars_by_oid(oids[i])); + OID oid(oids[i]); + EC_Domain_Params dom_pars(oid); dom_pars.get_base_point().check_invariants(); ECDSA_PrivateKey key(rng, dom_pars); diff --git a/checks/eckaeg.cpp b/checks/eckaeg.cpp index e5de2e425..d8a3f61d8 100644 --- a/checks/eckaeg.cpp +++ b/checks/eckaeg.cpp @@ -99,7 +99,9 @@ void test_eckaeg_some_dp(RandomNumberGenerator& rng) for(Botan::u32bit i = 0; i< oids.size(); i++) { std::cout << "." << std::flush; - Botan::EC_Domain_Params dom_pars(Botan::get_EC_Dom_Pars_by_oid(oids[i])); + + Botan::OID oid(oids[i]); + Botan::EC_Domain_Params dom_pars(oid); Botan::ECKAEG_PrivateKey private_a(rng, dom_pars); Botan::ECKAEG_PublicKey public_a = private_a; /*auto_ptr<Botan::X509_Encoder> x509_key_enc = public_a.x509_encoder(); @@ -135,7 +137,8 @@ void test_eckaeg_der_derivation(RandomNumberGenerator& rng) for(Botan::u32bit i = 0; i< oids.size(); i++) { - Botan::EC_Domain_Params dom_pars(Botan::get_EC_Dom_Pars_by_oid(oids[i])); + Botan::OID oid(oids[i]); + Botan::EC_Domain_Params dom_pars(oid); Botan::ECKAEG_PrivateKey private_a(rng, dom_pars); Botan::ECKAEG_PublicKey public_a = private_a; diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index a0ea1d1d3..124872866 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -296,7 +296,8 @@ void benchmark_ecdsa(RandomNumberGenerator& rng, for(size_t j = 0; domains[j]; j++) { - EC_Domain_Params params = get_EC_Dom_Pars_by_oid(domains[j]); + OID oid(domains[j]); + EC_Domain_Params params(oid); u32bit pbits = params.get_curve().get_p().bits(); @@ -353,7 +354,8 @@ void benchmark_eckaeg(RandomNumberGenerator& rng, for(size_t j = 0; domains[j]; j++) { - EC_Domain_Params params = get_EC_Dom_Pars_by_oid(domains[j]); + OID oid(domains[j]); + EC_Domain_Params params(oid); u32bit pbits = params.get_curve().get_p().bits(); diff --git a/checks/x509.cpp b/checks/x509.cpp index 8b7ce7d47..0891d8b35 100644 --- a/checks/x509.cpp +++ b/checks/x509.cpp @@ -161,7 +161,7 @@ void do_x509_tests(RandomNumberGenerator& rng) /* Create user #2's key and cert request */ std::cout << '.' << std::flush; #if defined(BOTAN_HAS_ECDSA) - EC_Domain_Params ecc_domain = get_EC_Dom_Pars_by_oid("1.2.840.10045.3.1.7"); + EC_Domain_Params ecc_domain(OID("1.2.840.10045.3.1.7")); ECDSA_PrivateKey user2_key(rng, ecc_domain); #else RSA_PrivateKey user2_key(rng, 1024); |