aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--checks/cvc_tests.cpp18
-rw-r--r--checks/ec_tests.cpp4
-rw-r--r--checks/ecdsa.cpp34
-rw-r--r--checks/eckaeg.cpp2
-rw-r--r--checks/pk.cpp16
-rw-r--r--checks/pk_bench.cpp24
-rw-r--r--checks/x509.cpp2
-rw-r--r--src/cert/cvc/cvc_ado.cpp4
-rw-r--r--src/cert/cvc/cvc_ado.h2
-rw-r--r--src/cert/cvc/cvc_ca.cpp2
-rw-r--r--src/cert/cvc/cvc_ca.h2
-rw-r--r--src/cert/cvc/cvc_cert.cpp2
-rw-r--r--src/cert/cvc/cvc_gen_cert.h12
-rw-r--r--src/cert/cvc/cvc_req.cpp2
-rw-r--r--src/cert/cvc/cvc_self.cpp47
-rw-r--r--src/cert/cvc/eac_obj.h10
-rw-r--r--src/cert/cvc/ecdsa_sig.cpp2
-rw-r--r--src/cert/x509/x509_ca.cpp4
-rw-r--r--src/cert/x509/x509_obj.cpp2
-rw-r--r--src/cert/x509/x509self.cpp4
-rw-r--r--src/cert/x509/x509stor.cpp4
-rw-r--r--src/math/numbertheory/dsa_gen.cpp2
-rw-r--r--src/pubkey/ec_dompar/ec_dompar.cpp2
-rw-r--r--src/pubkey/ecc_key/ecc_key.cpp2
-rw-r--r--src/pubkey/ecc_key/ecc_key.h4
-rw-r--r--src/pubkey/ecdsa/ecdsa.cpp11
-rw-r--r--src/pubkey/eckaeg/eckaeg.cpp4
-rw-r--r--src/pubkey/eckaeg/eckaeg.h2
-rw-r--r--src/pubkey/keypair/keypair.cpp8
-rw-r--r--src/pubkey/pubkey/pkcs8.cpp10
-rw-r--r--src/pubkey/pubkey/x509_key.cpp6
31 files changed, 129 insertions, 121 deletions
diff --git a/checks/cvc_tests.cpp b/checks/cvc_tests.cpp
index 792e9c58d..cde8c8b2c 100644
--- a/checks/cvc_tests.cpp
+++ b/checks/cvc_tests.cpp
@@ -163,8 +163,8 @@ void test_enc_gen_selfsigned(RandomNumberGenerator& rng)
}
CHECK(ill_date_exc2);
//cout << "readable = '" << cert_in.get_ced().readable_string() << "'\n";
- std::auto_ptr<Public_Key> p_pk = cert_in.subject_public_key();
- //auto_ptr<ECDSA_PublicKey> ecdsa_pk = dynamic_cast<auto_ptr<ECDSA_PublicKey> >(p_pk);
+ std::unique_ptr<Public_Key> p_pk = cert_in.subject_public_key();
+ //unique_ptr<ECDSA_PublicKey> ecdsa_pk = dynamic_cast<auto_ptr<ECDSA_PublicKey> >(p_pk);
ECDSA_PublicKey* p_ecdsa_pk = dynamic_cast<ECDSA_PublicKey*>(p_pk.get());
// let´s see if encoding is truely implicitca, because this is what the key should have
// been set to when decoding (see above)(because it has no domain params):
@@ -182,7 +182,7 @@ void test_enc_gen_selfsigned(RandomNumberGenerator& rng)
CHECK(exc);
// set them and try again
//cert_in.set_domain_parameters(dom_pars);
- std::auto_ptr<Public_Key> p_pk2 = cert_in.subject_public_key();
+ std::unique_ptr<Public_Key> p_pk2 = cert_in.subject_public_key();
ECDSA_PublicKey* p_ecdsa_pk2 = dynamic_cast<ECDSA_PublicKey*>(p_pk2.get());
p_ecdsa_pk2->set_domain_parameters(dom_pars);
CHECK(p_ecdsa_pk2->domain_parameters().get_order() == dom_pars.get_order());
@@ -213,7 +213,7 @@ void test_enc_gen_req(RandomNumberGenerator& rng)
// read and check signature...
EAC1_1_Req req_in(TEST_DATA_DIR "/my_cv_req.ber");
//req_in.set_domain_parameters(dom_pars);
- std::auto_ptr<Public_Key> p_pk = req_in.subject_public_key();
+ std::unique_ptr<Public_Key> p_pk = req_in.subject_public_key();
ECDSA_PublicKey* p_ecdsa_pk = dynamic_cast<ECDSA_PublicKey*>(p_pk.get());
p_ecdsa_pk->set_domain_parameters(dom_pars);
CHECK(p_ecdsa_pk->domain_parameters().get_order() == dom_pars.get_order());
@@ -228,7 +228,7 @@ void test_cvc_req_ext(RandomNumberGenerator&)
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"
//req_in.set_domain_parameters(dom_pars);
- std::auto_ptr<Public_Key> p_pk = req_in.subject_public_key();
+ std::unique_ptr<Public_Key> p_pk = req_in.subject_public_key();
ECDSA_PublicKey* p_ecdsa_pk = dynamic_cast<ECDSA_PublicKey*>(p_pk.get());
p_ecdsa_pk->set_domain_parameters(dom_pars);
CHECK(p_ecdsa_pk->domain_parameters().get_order() == dom_pars.get_order());
@@ -390,11 +390,11 @@ void test_ver_cvca(RandomNumberGenerator&)
EAC1_1_CVC req_in(TEST_DATA_DIR "/cvca01.cv.crt");
- //auto_ptr<ECDSA_PublicKey> ecdsa_pk = dynamic_cast<auto_ptr<ECDSA_PublicKey> >(p_pk);
+ //unique_ptr<ECDSA_PublicKey> ecdsa_pk = dynamic_cast<auto_ptr<ECDSA_PublicKey> >(p_pk);
//ECDSA_PublicKey* p_ecdsa_pk = dynamic_cast<ECDSA_PublicKey*>(p_pk.get());
bool exc = false;
- std::auto_ptr<Public_Key> p_pk2 = req_in.subject_public_key();
+ std::unique_ptr<Public_Key> p_pk2 = req_in.subject_public_key();
ECDSA_PublicKey* p_ecdsa_pk2 = dynamic_cast<ECDSA_PublicKey*>(p_pk2.get());
bool ver_ec = req_in.check_signature(*p_pk2);
CHECK_MESSAGE(ver_ec, "could not positively verify correct selfsigned cvca certificate");
@@ -512,7 +512,7 @@ void test_cvc_chain(RandomNumberGenerator& rng)
CHECK(link12.check_signature(cvca_privk));
EAC1_1_CVC link12_reloaded(TEST_DATA_DIR "/cvc_chain_link12.cer");
EAC1_1_CVC cvca1_reloaded(TEST_DATA_DIR "/cvc_chain_cvca.cer");
- std::auto_ptr<Public_Key> cvca1_rel_pk = cvca1_reloaded.subject_public_key();
+ std::unique_ptr<Public_Key> cvca1_rel_pk = cvca1_reloaded.subject_public_key();
CHECK(link12_reloaded.check_signature(*cvca1_rel_pk));
// create first round dvca-req
@@ -542,7 +542,7 @@ void test_cvc_chain(RandomNumberGenerator& rng)
// verify the ado and sign the request too
- std::auto_ptr<Public_Key> ap_pk = dvca_cert1.subject_public_key();
+ std::unique_ptr<Public_Key> ap_pk = dvca_cert1.subject_public_key();
ECDSA_PublicKey* cert_pk = dynamic_cast<ECDSA_PublicKey*>(ap_pk.get());
cert_pk->set_domain_parameters(dom_pars);
diff --git a/checks/ec_tests.cpp b/checks/ec_tests.cpp
index 2d25e2153..b079ebd47 100644
--- a/checks/ec_tests.cpp
+++ b/checks/ec_tests.cpp
@@ -794,11 +794,11 @@ void test_enc_dec_uncompressed_521_prime_too_large()
BigInt bi_b_secp = BigInt::decode ( sv_b_secp.begin(), sv_b_secp.size() );
CurveGFp secp521r1 ( GFpElement ( bi_p_secp,bi_a_secp ), GFpElement ( bi_p_secp, bi_b_secp ), bi_p_secp );
- std::auto_ptr<PointGFp> p_G;
+ std::unique_ptr<PointGFp> p_G;
bool exc = false;
try
{
- p_G = std::auto_ptr<PointGFp>(new PointGFp(OS2ECP ( sv_G_secp_uncomp, secp521r1)));
+ p_G = std::unique_ptr<PointGFp>(new PointGFp(OS2ECP ( sv_G_secp_uncomp, secp521r1)));
p_G->check_invariants();
}
catch (std::exception e)
diff --git a/checks/ecdsa.cpp b/checks/ecdsa.cpp
index 532a1c546..37880b755 100644
--- a/checks/ecdsa.cpp
+++ b/checks/ecdsa.cpp
@@ -70,7 +70,7 @@ void test_hash_larger_than_n(RandomNumberGenerator& rng)
{
format = "EMSA1_BSI(SHA-1)";
}
- std::auto_ptr<PK_Signer> pk_signer(get_pk_signer(priv_key, format));
+ std::unique_ptr<PK_Signer> pk_signer(get_pk_signer(priv_key, format));
SecureVector<byte> signature;
bool sig_exc = false;
try
@@ -93,7 +93,7 @@ void test_hash_larger_than_n(RandomNumberGenerator& rng)
if(i==0) // makes no sense to check for sha224
{
- std::auto_ptr<PK_Verifier> pk_verifier(get_pk_verifier(priv_key, format));
+ std::unique_ptr<PK_Verifier> pk_verifier(get_pk_verifier(priv_key, format));
bool ver = pk_verifier->verify_message(message, signature);
CHECK(ver);
}
@@ -103,10 +103,10 @@ void test_hash_larger_than_n(RandomNumberGenerator& rng)
// now check that verification alone fails
// sign it with the normal EMSA1
- std::auto_ptr<PK_Signer> pk_signer(get_pk_signer(priv_key, "EMSA1(SHA-224)"));
+ std::unique_ptr<PK_Signer> pk_signer(get_pk_signer(priv_key, "EMSA1(SHA-224)"));
SecureVector<byte> signature = pk_signer->sign_message(message, rng);
- std::auto_ptr<PK_Verifier> pk_verifier(get_pk_verifier(priv_key, "EMSA1_BSI(SHA-224)"));
+ std::unique_ptr<PK_Verifier> pk_verifier(get_pk_verifier(priv_key, "EMSA1_BSI(SHA-224)"));
// verify against EMSA1_BSI
// we make sure it doesn't fail because of the invalid signature,
@@ -164,7 +164,7 @@ void test_decode_ecdsa_X509()
CHECK_MESSAGE(to_hex(cert.authority_key_id()) == "0096452DE588F966C4CCDF161DD1F3F5341B71E7", "error reading authority key id from x509 ecdsa certificate");
CHECK_MESSAGE(to_hex(cert.subject_key_id()) == "0096452DE588F966C4CCDF161DD1F3F5341B71E7", "error reading Subject key id from x509 ecdsa certificate");
- std::auto_ptr<X509_PublicKey> pubkey(cert.subject_public_key());
+ std::unique_ptr<X509_PublicKey> pubkey(cert.subject_public_key());
bool ver_ec = cert.check_signature(*pubkey);
CHECK_MESSAGE(ver_ec, "could not positively verify correct selfsigned x509-ecdsa certificate");
}
@@ -176,7 +176,7 @@ void test_decode_ver_link_SHA256()
X509_Certificate root_cert(TEST_DATA_DIR "/root2_SHA256.cer");
X509_Certificate link_cert(TEST_DATA_DIR "/link_SHA256.cer");
- std::auto_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
+ std::unique_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
bool ver_ec = link_cert.check_signature(*pubkey);
CHECK_MESSAGE(ver_ec, "could not positively verify correct SHA256 link x509-ecdsa certificate");
@@ -188,7 +188,7 @@ void test_decode_ver_link_SHA1()
X509_Certificate root_cert(TEST_DATA_DIR "/root_SHA1.163.crt");
X509_Certificate link_cert(TEST_DATA_DIR "/link_SHA1.166.crt");
- std::auto_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
+ std::unique_ptr<X509_PublicKey> pubkey(root_cert.subject_public_key());
bool ver_ec = link_cert.check_signature(*pubkey);
CHECK_MESSAGE(ver_ec, "could not positively verify correct SHA1 link x509-ecdsa certificate");
}
@@ -231,8 +231,8 @@ bool test_ec_sign(RandomNumberGenerator& rng)
ECDSA_PrivateKey priv_key(rng, dom_pars);
std::string pem_encoded_key = PKCS8::PEM_encode(priv_key);
- std::auto_ptr<PK_Signer> signer(get_pk_signer(priv_key, "EMSA1(SHA-224)"));
- std::auto_ptr<PK_Verifier> verifier(get_pk_verifier(priv_key, "EMSA1(SHA-224)"));
+ std::unique_ptr<PK_Signer> signer(get_pk_signer(priv_key, "EMSA1(SHA-224)"));
+ std::unique_ptr<PK_Verifier> verifier(get_pk_verifier(priv_key, "EMSA1(SHA-224)"));
for(u32bit i = 0; i != 256; ++i)
signer->update((byte)i);
@@ -313,11 +313,11 @@ void test_create_and_verify(RandomNumberGenerator& rng)
std::ofstream priv_key(TEST_DATA_DIR "/dompar_private.pkcs8.pem");
priv_key << PKCS8::PEM_encode(key);
- std::auto_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
CHECK_MESSAGE(loaded_ec_key, "the loaded key could not be converted into an ECDSA_PrivateKey");
- std::auto_ptr<PKCS8_PrivateKey> loaded_key_1(PKCS8::load_key(TEST_DATA_DIR "/rsa_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key_1(PKCS8::load_key(TEST_DATA_DIR "/rsa_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_rsa_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key_1.get());
CHECK_MESSAGE(!loaded_rsa_key, "the loaded key is ECDSA_PrivateKey -> shouldn't be, is a RSA-Key");
@@ -350,7 +350,7 @@ void test_create_and_verify(RandomNumberGenerator& rng)
std::string key_odd_oid_str = PKCS8::PEM_encode(key_odd_oid);
DataSource_Memory key_data_src(key_odd_oid_str);
- std::auto_ptr<PKCS8_PrivateKey> loaded_key2(PKCS8::load_key(key_data_src, rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key2(PKCS8::load_key(key_data_src, rng));
if(!dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get()))
{
@@ -420,7 +420,7 @@ void test_read_pkcs8(RandomNumberGenerator& rng)
std::cout << "." << std::flush;
try
{
- std::auto_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
CHECK_MESSAGE(loaded_ec_key, "the loaded key could not be converted into an ECDSA_PrivateKey");
@@ -431,7 +431,7 @@ void test_read_pkcs8(RandomNumberGenerator& rng)
bool ver_success = loaded_ec_key->verify(sv_message.begin(), sv_message.size(), signature.begin(), signature.size());
CHECK_MESSAGE(ver_success, "generated signature could not be verified positively");
- std::auto_ptr<PKCS8_PrivateKey> loaded_key_nodp(PKCS8::load_key(TEST_DATA_DIR "/nodompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key_nodp(PKCS8::load_key(TEST_DATA_DIR "/nodompar_private.pkcs8.pem", rng));
// anew in each test with unregistered domain-parameters
ECDSA_PrivateKey* loaded_ec_key_nodp = dynamic_cast<ECDSA_PrivateKey*>(loaded_key_nodp.get());
CHECK_MESSAGE(loaded_ec_key_nodp, "the loaded key could not be converted into an ECDSA_PrivateKey");
@@ -442,7 +442,7 @@ void test_read_pkcs8(RandomNumberGenerator& rng)
CHECK_MESSAGE(ver_success_nodp, "generated signature could not be verified positively (no_dom)");
try
{
- std::auto_ptr<PKCS8_PrivateKey> loaded_key_withdp(PKCS8::load_key(TEST_DATA_DIR "/withdompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key_withdp(PKCS8::load_key(TEST_DATA_DIR "/withdompar_private.pkcs8.pem", rng));
std::cout << "Unexpected success: loaded key with unknown OID\n";
}
@@ -461,7 +461,7 @@ void test_cp_and_as_ctors(RandomNumberGenerator& rng)
{
std::cout << "." << std::flush;
- std::auto_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
CHECK_MESSAGE(loaded_ec_key, "the loaded key could not be converted into an ECDSA_PrivateKey");
std::string str_message = ("12345678901234567890abcdef12");
@@ -497,7 +497,7 @@ void test_non_init_ecdsa_keys(RandomNumberGenerator& rng)
{
std::cout << "." << std::flush;
- std::auto_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
+ std::unique_ptr<PKCS8_PrivateKey> loaded_key(PKCS8::load_key(TEST_DATA_DIR "/wo_dompar_private.pkcs8.pem", rng));
//ECDSA_PrivateKey* loaded_ec_key = dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get());
//CHECK_MESSAGE(loaded_ec_key, "the loaded key could not be converted into an ECDSA_PrivateKey");
std::string str_message = ("12345678901234567890abcdef12");
diff --git a/checks/eckaeg.cpp b/checks/eckaeg.cpp
index f25fbb292..501ad8c3d 100644
--- a/checks/eckaeg.cpp
+++ b/checks/eckaeg.cpp
@@ -103,7 +103,7 @@ void test_eckaeg_some_dp(RandomNumberGenerator& rng)
Botan::EC_Domain_Params dom_pars(Botan::get_EC_Dom_Pars_by_oid(oids[i]));
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();
+ /*unique_ptr<Botan::X509_Encoder> x509_key_enc = public_a.x509_encoder();
Botan::MemoryVector<Botan::byte> enc_key_a = Botan::DER_Encoder()
.start_cons(Botan::SEQUENCE)
.encode(x509_key_enc->alg_id())
diff --git a/checks/pk.cpp b/checks/pk.cpp
index c02005245..e8746ad04 100644
--- a/checks/pk.cpp
+++ b/checks/pk.cpp
@@ -178,7 +178,7 @@ u32bit validate_rsa_enc_pkcs8(const std::string& algo,
DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
str[0].length());
- std::auto_ptr<Private_Key> privkey(PKCS8::load_key(keysource, rng, pass));
+ std::unique_ptr<Private_Key> privkey(PKCS8::load_key(keysource, rng, pass));
RSA_PrivateKey* rsapriv = dynamic_cast<RSA_PrivateKey*>(privkey.get());
if(!rsapriv)
@@ -297,7 +297,7 @@ u32bit validate_rsa_ver(const std::string& algo,
std::string emsa = algo.substr(6, std::string::npos);
- std::auto_ptr<PK_Verifier> v(get_pk_verifier(key, emsa));
+ std::unique_ptr<PK_Verifier> v(get_pk_verifier(key, emsa));
SecureVector<byte> msg = decode_hex(str[2]);
SecureVector<byte> sig = decode_hex(str[3]);
@@ -320,7 +320,7 @@ u32bit validate_rsa_ver_x509(const std::string& algo,
DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
str[0].length());
- std::auto_ptr<Public_Key> key(X509::load_key(keysource));
+ std::unique_ptr<Public_Key> key(X509::load_key(keysource));
RSA_PublicKey* rsakey = dynamic_cast<RSA_PublicKey*>(key.get());
@@ -329,7 +329,7 @@ u32bit validate_rsa_ver_x509(const std::string& algo,
std::string emsa = algo.substr(11, std::string::npos);
- std::auto_ptr<PK_Verifier> v(get_pk_verifier(*rsakey, emsa));
+ std::unique_ptr<PK_Verifier> v(get_pk_verifier(*rsakey, emsa));
SecureVector<byte> msg = decode_hex(str[1]);
SecureVector<byte> sig = decode_hex(str[2]);
@@ -355,7 +355,7 @@ u32bit validate_rw_ver(const std::string& algo,
std::string emsa = algo.substr(5, std::string::npos);
- std::auto_ptr<PK_Verifier> v(get_pk_verifier(key, emsa));
+ std::unique_ptr<PK_Verifier> v(get_pk_verifier(key, emsa));
SecureVector<byte> msg = decode_hex(str[2]);
SecureVector<byte> sig = decode_hex(str[3]);
@@ -411,7 +411,7 @@ u32bit validate_dsa_sig(const std::string& algo,
DataSource_Memory keysource(reinterpret_cast<const byte*>(str[0].c_str()),
str[0].length());
- std::auto_ptr<Private_Key> privkey(PKCS8::load_key(keysource, rng, pass));
+ std::unique_ptr<Private_Key> privkey(PKCS8::load_key(keysource, rng, pass));
DSA_PrivateKey* dsapriv = dynamic_cast<DSA_PrivateKey*>(privkey.get());
if(!dsapriv)
@@ -443,7 +443,7 @@ u32bit validate_dsa_ver(const std::string& algo,
#if defined(BOTAN_HAS_DSA)
- std::auto_ptr<Public_Key> key(X509::load_key(keysource));
+ std::unique_ptr<Public_Key> key(X509::load_key(keysource));
DSA_PublicKey* dsakey = dynamic_cast<DSA_PublicKey*>(key.get());
@@ -452,7 +452,7 @@ u32bit validate_dsa_ver(const std::string& algo,
std::string emsa = algo.substr(7, std::string::npos);
- std::auto_ptr<PK_Verifier> v(get_pk_verifier(*dsakey, emsa));
+ std::unique_ptr<PK_Verifier> v(get_pk_verifier(*dsakey, emsa));
SecureVector<byte> msg = decode_hex(str[1]);
SecureVector<byte> sig = decode_hex(str[2]);
diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp
index a944934fb..8e5054a9a 100644
--- a/checks/pk_bench.cpp
+++ b/checks/pk_bench.cpp
@@ -191,12 +191,12 @@ void benchmark_rsa(RandomNumberGenerator& rng,
while(verify_timer.seconds() < seconds ||
sig_timer.seconds() < seconds)
{
- std::auto_ptr<PK_Encryptor> enc(get_pk_encryptor(key, enc_padding));
- std::auto_ptr<PK_Decryptor> dec(get_pk_decryptor(key, enc_padding));
+ std::unique_ptr<PK_Encryptor> enc(get_pk_encryptor(key, enc_padding));
+ std::unique_ptr<PK_Decryptor> dec(get_pk_decryptor(key, enc_padding));
benchmark_enc_dec(*enc, *dec, enc_timer, dec_timer, rng, 10000, seconds);
- std::auto_ptr<PK_Signer> sig(get_pk_signer(key, sig_padding));
- std::auto_ptr<PK_Verifier> ver(get_pk_verifier(key, sig_padding));
+ std::unique_ptr<PK_Signer> sig(get_pk_signer(key, sig_padding));
+ std::unique_ptr<PK_Verifier> ver(get_pk_verifier(key, sig_padding));
benchmark_sig_ver(*ver, *sig, verify_timer,
sig_timer, rng, 10000, seconds);
}
@@ -246,8 +246,8 @@ void benchmark_rw(RandomNumberGenerator& rng,
RW_PrivateKey key(rng, keylen);
keygen_timer.stop();
- std::auto_ptr<PK_Signer> sig(get_pk_signer(key, padding));
- std::auto_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
+ std::unique_ptr<PK_Signer> sig(get_pk_signer(key, padding));
+ std::unique_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
benchmark_sig_ver(*ver, *sig, verify_timer, sig_timer, rng, 10000, seconds);
}
@@ -300,8 +300,8 @@ void benchmark_ecdsa(RandomNumberGenerator& rng,
ECDSA_PrivateKey key(rng, params);
keygen_timer.stop();
- std::auto_ptr<PK_Signer> sig(get_pk_signer(key, padding));
- std::auto_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
+ std::unique_ptr<PK_Signer> sig(get_pk_signer(key, padding));
+ std::unique_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
benchmark_sig_ver(*ver, *sig, verify_timer,
sig_timer, rng, 1000, seconds);
@@ -416,8 +416,8 @@ void benchmark_dsa_nr(RandomNumberGenerator& rng,
PRIV_KEY_TYPE key(rng, group);
keygen_timer.stop();
- std::auto_ptr<PK_Signer> sig(get_pk_signer(key, padding));
- std::auto_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
+ std::unique_ptr<PK_Signer> sig(get_pk_signer(key, padding));
+ std::unique_ptr<PK_Verifier> ver(get_pk_verifier(key, padding));
benchmark_sig_ver(*ver, *sig, verify_timer,
sig_timer, rng, 1000, seconds);
@@ -586,8 +586,8 @@ void benchmark_elg(RandomNumberGenerator& rng,
ElGamal_PrivateKey key(rng, group);
keygen_timer.stop();
- std::auto_ptr<PK_Decryptor> dec(get_pk_decryptor(key, padding));
- std::auto_ptr<PK_Encryptor> enc(get_pk_encryptor(key, padding));
+ std::unique_ptr<PK_Decryptor> dec(get_pk_decryptor(key, padding));
+ std::unique_ptr<PK_Encryptor> enc(get_pk_encryptor(key, padding));
benchmark_enc_dec(*enc, *dec, enc_timer, dec_timer, rng, 1000, seconds);
}
diff --git a/checks/x509.cpp b/checks/x509.cpp
index 6f191285c..3aba4ce1a 100644
--- a/checks/x509.cpp
+++ b/checks/x509.cpp
@@ -34,7 +34,7 @@ namespace {
u64bit key_id(const Public_Key* key)
{
- std::auto_ptr<X509_Encoder> encoder(key->x509_encoder());
+ std::unique_ptr<X509_Encoder> encoder(key->x509_encoder());
if(!encoder.get())
throw Internal_Error("Public_Key:key_id: No encoder found");
diff --git a/src/cert/cvc/cvc_ado.cpp b/src/cert/cvc/cvc_ado.cpp
index 6e1484e90..19d76fe7f 100644
--- a/src/cert/cvc/cvc_ado.cpp
+++ b/src/cert/cvc/cvc_ado.cpp
@@ -47,12 +47,12 @@ void EAC1_1_ADO::force_decode()
}
MemoryVector<byte> EAC1_1_ADO::make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng)
{
SecureVector<byte> concat_sig =
- EAC1_1_obj<EAC1_1_ADO>::make_signature(signer.get(), tbs_bits, rng);
+ EAC1_1_obj<EAC1_1_ADO>::make_signature(signer, tbs_bits, rng);
assert(concat_sig.size() % 2 == 0);
MemoryVector<byte> result = DER_Encoder()
.start_cons(ASN1_Tag(7), APPLICATION)
diff --git a/src/cert/cvc/cvc_ado.h b/src/cert/cvc/cvc_ado.h
index 2c4f3ce70..ef469cc09 100644
--- a/src/cert/cvc/cvc_ado.h
+++ b/src/cert/cvc/cvc_ado.h
@@ -47,7 +47,7 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
* @param tbs_bits the TBS data to sign
*/
static MemoryVector<byte> make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
diff --git a/src/cert/cvc/cvc_ca.cpp b/src/cert/cvc/cvc_ca.cpp
index 638d3f984..7b1c5fcba 100644
--- a/src/cert/cvc/cvc_ca.cpp
+++ b/src/cert/cvc/cvc_ca.cpp
@@ -5,7 +5,7 @@
#include <botan/oids.h>
namespace Botan {
-EAC1_1_CVC EAC1_1_CVC_CA::make_cert(std::auto_ptr<PK_Signer> signer,
+EAC1_1_CVC EAC1_1_CVC_CA::make_cert(PK_Signer& signer,
MemoryRegion<byte> const& public_key,
ASN1_Car const& car,
ASN1_Chr const& chr,
diff --git a/src/cert/cvc/cvc_ca.h b/src/cert/cvc/cvc_ca.h
index 3ec307bb3..87699808f 100644
--- a/src/cert/cvc/cvc_ca.h
+++ b/src/cert/cvc/cvc_ca.h
@@ -36,7 +36,7 @@ class BOTAN_DLL EAC1_1_CVC_CA
* @param ced the CED to appear in the certificate
* @param ced the CEX to appear in the certificate
*/
- static EAC1_1_CVC make_cert(std::auto_ptr<PK_Signer> signer,
+ static EAC1_1_CVC make_cert(PK_Signer& signer,
MemoryRegion<byte> const& public_key,
ASN1_Car const& car,
ASN1_Chr const& chr,
diff --git a/src/cert/cvc/cvc_cert.cpp b/src/cert/cvc/cvc_cert.cpp
index 71ca0cf16..7964b8900 100644
--- a/src/cert/cvc/cvc_cert.cpp
+++ b/src/cert/cvc/cvc_cert.cpp
@@ -61,7 +61,7 @@ void EAC1_1_CVC::force_decode()
// XXX: PK algos have no notion of EAC encoder/decoder currently
#if 0
ECDSA_PublicKey tmp_pk;
- std::auto_ptr<EAC1_1_CVC_Decoder> dec = tmp_pk.cvc_eac1_1_decoder();
+ std::unique_ptr<EAC1_1_CVC_Decoder> dec = tmp_pk.cvc_eac1_1_decoder();
sig_algo = dec->public_key(enc_pk);
diff --git a/src/cert/cvc/cvc_gen_cert.h b/src/cert/cvc/cvc_gen_cert.h
index 4a788026c..8620cd89a 100644
--- a/src/cert/cvc/cvc_gen_cert.h
+++ b/src/cert/cvc/cvc_gen_cert.h
@@ -33,7 +33,7 @@ class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation
* Get this certificates public key.
* @result this certificates public key
*/
- std::auto_ptr<Public_Key> subject_public_key() const;
+ std::unique_ptr<Public_Key> subject_public_key() const;
/**
* Find out whether this object is self signed.
@@ -75,7 +75,7 @@ class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation
* @result the DER encoded signed generalized CVC object
*/
static MemoryVector<byte> make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
virtual ~EAC1_1_gen_CVC<Derived>()
@@ -103,11 +103,11 @@ template<typename Derived> bool EAC1_1_gen_CVC<Derived>::is_self_signed() const
}
template<typename Derived> MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng) // static
{
- SecureVector<byte> concat_sig = EAC1_1_obj<Derived>::make_signature(signer.get(), tbs_bits, rng);
+ SecureVector<byte> concat_sig = EAC1_1_obj<Derived>::make_signature(signer, tbs_bits, rng);
assert(concat_sig.size() % 2 == 0);
return DER_Encoder()
.start_cons(ASN1_Tag(33), APPLICATION)
@@ -117,9 +117,9 @@ template<typename Derived> MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_sign
.get_contents();
}
-template<typename Derived> std::auto_ptr<Public_Key> EAC1_1_gen_CVC<Derived>::subject_public_key() const
+template<typename Derived> std::unique_ptr<Public_Key> EAC1_1_gen_CVC<Derived>::subject_public_key() const
{
- return std::auto_ptr<Public_Key>(new ECDSA_PublicKey(m_pk));
+ return std::unique_ptr<Public_Key>(new ECDSA_PublicKey(m_pk));
}
template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::build_cert_body(MemoryRegion<byte> const& tbs)
diff --git a/src/cert/cvc/cvc_req.cpp b/src/cert/cvc/cvc_req.cpp
index a9a94827c..c2318dc1b 100644
--- a/src/cert/cvc/cvc_req.cpp
+++ b/src/cert/cvc/cvc_req.cpp
@@ -44,7 +44,7 @@ void EAC1_1_Req::force_decode()
// XXX: No EAC support in ECDSA
#if 0
ECDSA_PublicKey tmp_pk;
- std::auto_ptr<EAC1_1_CVC_Decoder> dec = tmp_pk.cvc_eac1_1_decoder();
+ std::unique_ptr<EAC1_1_CVC_Decoder> dec = tmp_pk.cvc_eac1_1_decoder();
sig_algo = dec->public_key(enc_pk);
m_pk = tmp_pk;
#endif
diff --git a/src/cert/cvc/cvc_self.cpp b/src/cert/cvc/cvc_self.cpp
index 45a584cb3..c31741956 100644
--- a/src/cert/cvc/cvc_self.cpp
+++ b/src/cert/cvc/cvc_self.cpp
@@ -84,16 +84,18 @@ EAC1_1_CVC create_self_signed_cert(Private_Key const& key,
sig_algo.oid = OIDS::lookup(priv_key->algo_name() + "/" + padding_and_hash);
sig_algo = AlgorithmIdentifier(sig_algo.oid, AlgorithmIdentifier::USE_NULL_PARAM);
- std::auto_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
+ std::unique_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
#if 0
- std::auto_ptr<EAC1_1_CVC_Encoder> enc(priv_key->cvc_eac1_1_encoder());
+ std::unique_ptr<EAC1_1_CVC_Encoder> enc(priv_key->cvc_eac1_1_encoder());
MemoryVector<byte> enc_public_key = enc->public_key(sig_algo);
#else
MemoryVector<byte> enc_public_key;
#endif
- return EAC1_1_CVC_CA::make_cert(signer, enc_public_key, opt.car, chr, opt.holder_auth_templ, opt.ced, opt.cex, rng);
+ return EAC1_1_CVC_CA::make_cert(*signer.get(), enc_public_key,
+ opt.car, chr, opt.holder_auth_templ,
+ opt.ced, opt.cex, rng);
}
@@ -113,10 +115,10 @@ EAC1_1_Req create_cvc_req(Private_Key const& key,
sig_algo.oid = OIDS::lookup(priv_key->algo_name() + "/" + padding_and_hash);
sig_algo = AlgorithmIdentifier(sig_algo.oid, AlgorithmIdentifier::USE_NULL_PARAM);
- std::auto_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
+ std::unique_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
-#if 0
- std::auto_ptr<EAC1_1_CVC_Encoder> enc(priv_key->cvc_eac1_1_encoder());
+#if 0 // FIXME
+ std::unique_ptr<EAC1_1_CVC_Encoder> enc(priv_key->cvc_eac1_1_encoder());
MemoryVector<byte> enc_public_key = enc->public_key(sig_algo);
#else
MemoryVector<byte> enc_public_key;
@@ -130,7 +132,10 @@ EAC1_1_Req create_cvc_req(Private_Key const& key,
.encode(chr)
.get_contents();
- MemoryVector<byte> signed_cert = EAC1_1_gen_CVC<EAC1_1_Req>::make_signed(signer, EAC1_1_gen_CVC<EAC1_1_Req>::build_cert_body(tbs), rng);
+ MemoryVector<byte> signed_cert =
+ EAC1_1_gen_CVC<EAC1_1_Req>::make_signed(*signer.get(),
+ EAC1_1_gen_CVC<EAC1_1_Req>::build_cert_body(tbs), rng);
+
std::tr1::shared_ptr<DataSource> source(new DataSource_Memory(signed_cert));
return EAC1_1_Req(source);
}
@@ -146,11 +151,15 @@ EAC1_1_ADO create_ado_req(Private_Key const& key,
{
throw Invalid_Argument("CVC_EAC::create_self_signed_cert(): unsupported key type");
}
+
std::string padding_and_hash = padding_and_hash_from_oid(req.signature_algorithm().oid);
- std::auto_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
+
+ std::unique_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
+
SecureVector<byte> tbs_bits = req.BER_encode();
tbs_bits.append(DER_Encoder().encode(car).get_contents());
- MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(signer, tbs_bits, rng);
+
+ MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(*signer.get(), tbs_bits, rng);
std::tr1::shared_ptr<DataSource> source(new DataSource_Memory(signed_cert));
return EAC1_1_ADO(source);
}
@@ -210,19 +219,19 @@ EAC1_1_CVC link_cvca(EAC1_1_CVC const& signer,
}
AlgorithmIdentifier sig_algo = signer.signature_algorithm();
std::string padding_and_hash = padding_and_hash_from_oid(sig_algo.oid);
- std::auto_ptr<Botan::PK_Signer> pk_signer(get_pk_signer(*priv_key, padding_and_hash));
- std::auto_ptr<Public_Key> pk = signee.subject_public_key();
+ std::unique_ptr<Botan::PK_Signer> pk_signer(get_pk_signer(*priv_key, padding_and_hash));
+ std::unique_ptr<Public_Key> pk = signee.subject_public_key();
ECDSA_PublicKey* subj_pk = dynamic_cast<ECDSA_PublicKey*>(pk.get());
subj_pk->set_parameter_encoding(ENC_EXPLICIT);
#if 0
- std::auto_ptr<EAC1_1_CVC_Encoder> enc(subj_pk->cvc_eac1_1_encoder());
+ std::unique_ptr<EAC1_1_CVC_Encoder> enc(subj_pk->cvc_eac1_1_encoder());
MemoryVector<byte> enc_public_key = enc->public_key(sig_algo);
#else
MemoryVector<byte> enc_public_key;
#endif
- return EAC1_1_CVC_CA::make_cert(pk_signer, enc_public_key,
+ return EAC1_1_CVC_CA::make_cert(*pk_signer.get(), enc_public_key,
signer.get_car(),
signee.get_chr(),
signer.get_chat_value(),
@@ -250,10 +259,10 @@ EAC1_1_CVC sign_request(EAC1_1_CVC const& signer_cert,
chr_str.append(fixed_len_seqnr(seqnr, seqnr_len));
ASN1_Chr chr(chr_str);
std::string padding_and_hash = padding_and_hash_from_oid(signee.signature_algorithm().oid);
- std::auto_ptr<Botan::PK_Signer> pk_signer(get_pk_signer(*priv_key, padding_and_hash));
- std::auto_ptr<Public_Key> pk = signee.subject_public_key();
+ std::unique_ptr<Botan::PK_Signer> pk_signer(get_pk_signer(*priv_key, padding_and_hash));
+ std::unique_ptr<Public_Key> pk = signee.subject_public_key();
ECDSA_PublicKey* subj_pk = dynamic_cast<ECDSA_PublicKey*>(pk.get());
- std::auto_ptr<Public_Key> signer_pk = signer_cert.subject_public_key();
+ std::unique_ptr<Public_Key> signer_pk = signer_cert.subject_public_key();
// for the case that the domain parameters are not set...
// (we use those from the signer because they must fit)
@@ -261,8 +270,8 @@ EAC1_1_CVC sign_request(EAC1_1_CVC const& signer_cert,
subj_pk->set_parameter_encoding(ENC_IMPLICITCA);
-#if 0
- std::auto_ptr<EAC1_1_CVC_Encoder> enc(subj_pk->cvc_eac1_1_encoder());
+#if 0 // FIXME
+ std::unique_ptr<EAC1_1_CVC_Encoder> enc(subj_pk->cvc_eac1_1_encoder());
MemoryVector<byte> enc_public_key = enc->public_key(sig_algo);
#else
MemoryVector<byte> enc_public_key;
@@ -298,7 +307,7 @@ EAC1_1_CVC sign_request(EAC1_1_CVC const& signer_cert,
throw Invalid_Argument("sign_request(): encountered illegal value for CHAT");
// (IS cannot sign certificates)
}
- return EAC1_1_CVC_CA::make_cert(pk_signer, enc_public_key,
+ return EAC1_1_CVC_CA::make_cert(*pk_signer.get(), enc_public_key,
ASN1_Car(signer_cert.get_chr().iso_8859()),
chr,
chat_val,
diff --git a/src/cert/cvc/eac_obj.h b/src/cert/cvc/eac_obj.h
index 04afd7e59..b41b78b2c 100644
--- a/src/cert/cvc/eac_obj.h
+++ b/src/cert/cvc/eac_obj.h
@@ -54,7 +54,7 @@ class BOTAN_DLL EAC1_1_obj : public EAC_Signed_Object
protected:
void init(SharedPtrConverter<DataSource> in);
- static SecureVector<byte> make_signature(PK_Signer* signer,
+ static SecureVector<byte> make_signature(PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
@@ -68,12 +68,12 @@ template<typename Derived> SecureVector<byte> EAC1_1_obj<Derived>::get_concat_si
}
template<typename Derived> SecureVector<byte>
-EAC1_1_obj<Derived>::make_signature(PK_Signer* signer,
+EAC1_1_obj<Derived>::make_signature(PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng)
{
// this is the signature as a der sequence
- SecureVector<byte> seq_sig = signer->sign_message(tbs_bits, rng);
+ SecureVector<byte> seq_sig = signer.sign_message(tbs_bits, rng);
ECDSA_Signature sig(decode_seq(seq_sig));
SecureVector<byte> concat_sig(sig.get_concatenation());
@@ -112,12 +112,12 @@ bool EAC1_1_obj<Derived>::check_signature(Public_Key& pub_key) const
if(!dynamic_cast<PK_Verifying_wo_MR_Key*>(&pub_key))
return false;
- std::auto_ptr<ECDSA_Signature_Encoder> enc(new ECDSA_Signature_Encoder(&m_sig));
+ std::unique_ptr<ECDSA_Signature_Encoder> enc(new ECDSA_Signature_Encoder(&m_sig));
SecureVector<byte> seq_sig = enc->signature_bits();
SecureVector<byte> to_sign = tbs_data();
PK_Verifying_wo_MR_Key& sig_key = dynamic_cast<PK_Verifying_wo_MR_Key&>(pub_key);
- std::auto_ptr<PK_Verifier> verifier(get_pk_verifier(sig_key, padding, format));
+ std::unique_ptr<PK_Verifier> verifier(get_pk_verifier(sig_key, padding, format));
return verifier->verify_message(to_sign, seq_sig);
}
catch(...)
diff --git a/src/cert/cvc/ecdsa_sig.cpp b/src/cert/cvc/ecdsa_sig.cpp
index c33a4550a..1a60f7aa8 100644
--- a/src/cert/cvc/ecdsa_sig.cpp
+++ b/src/cert/cvc/ecdsa_sig.cpp
@@ -41,7 +41,7 @@ ECDSA_Signature const decode_seq(MemoryRegion<byte> const& seq)
{
ECDSA_Signature sig;
- std::auto_ptr<ECDSA_Signature_Decoder> dec(new ECDSA_Signature_Decoder(&sig));
+ std::unique_ptr<ECDSA_Signature_Decoder> dec(new ECDSA_Signature_Decoder(&sig));
dec->signature_bits(seq);
return sig;
}
diff --git a/src/cert/x509/x509_ca.cpp b/src/cert/x509/x509_ca.cpp
index 41e314724..05cdce411 100644
--- a/src/cert/x509/x509_ca.cpp
+++ b/src/cert/x509/x509_ca.cpp
@@ -51,7 +51,7 @@ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req,
constraints = Key_Constraints(KEY_CERT_SIGN | CRL_SIGN);
else
{
- std::auto_ptr<Public_Key> key(req.subject_public_key());
+ std::unique_ptr<Public_Key> key(req.subject_public_key());
constraints = X509::find_constraints(*key, req.constraints());
}
@@ -269,7 +269,7 @@ PK_Signer* choose_sig_format(const Private_Key& key,
sig_algo.oid = OIDS::lookup(algo_name + "/" + padding);
- std::auto_ptr<X509_Encoder> encoding(key.x509_encoder());
+ std::unique_ptr<X509_Encoder> encoding(key.x509_encoder());
if(!encoding.get())
throw Encoding_Error("Key " + algo_name + " does not support "
"X.509 encoding");
diff --git a/src/cert/x509/x509_obj.cpp b/src/cert/x509/x509_obj.cpp
index 31b4a309f..95a1c1cca 100644
--- a/src/cert/x509/x509_obj.cpp
+++ b/src/cert/x509/x509_obj.cpp
@@ -168,7 +168,7 @@ bool X509_Object::check_signature(Public_Key& pub_key) const
Signature_Format format =
(pub_key.message_parts() >= 2) ? DER_SEQUENCE : IEEE_1363;
- std::auto_ptr<PK_Verifier> verifier;
+ std::unique_ptr<PK_Verifier> verifier;
if(dynamic_cast<PK_Verifying_with_MR_Key*>(&pub_key))
{
diff --git a/src/cert/x509/x509self.cpp b/src/cert/x509/x509self.cpp
index 8afb22a7e..598d6a418 100644
--- a/src/cert/x509/x509self.cpp
+++ b/src/cert/x509/x509self.cpp
@@ -72,7 +72,7 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts,
AlternativeName subject_alt;
MemoryVector<byte> pub_key = shared_setup(opts, key);
- std::auto_ptr<PK_Signer> signer(choose_sig_format(key, sig_algo));
+ std::unique_ptr<PK_Signer> signer(choose_sig_format(key, sig_algo));
load_info(opts, subject_dn, subject_alt);
Key_Constraints constraints;
@@ -110,7 +110,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
AlternativeName subject_alt;
MemoryVector<byte> pub_key = shared_setup(opts, key);
- std::auto_ptr<PK_Signer> signer(choose_sig_format(key, sig_algo));
+ std::unique_ptr<PK_Signer> signer(choose_sig_format(key, sig_algo));
load_info(opts, subject_dn, subject_alt);
const u32bit PKCS10_VERSION = 0;
diff --git a/src/cert/x509/x509stor.cpp b/src/cert/x509/x509stor.cpp
index cb61bc2d2..f91da890b 100644
--- a/src/cert/x509/x509stor.cpp
+++ b/src/cert/x509/x509stor.cpp
@@ -380,8 +380,8 @@ X509_Code X509_Store::check_sig(const Cert_Info& cert_info,
*/
X509_Code X509_Store::check_sig(const X509_Object& object, Public_Key* key)
{
- std::auto_ptr<Public_Key> pub_key(key);
- std::auto_ptr<PK_Verifier> verifier;
+ std::unique_ptr<Public_Key> pub_key(key);
+ std::unique_ptr<PK_Verifier> verifier;
try {
std::vector<std::string> sig_info =
diff --git a/src/math/numbertheory/dsa_gen.cpp b/src/math/numbertheory/dsa_gen.cpp
index 83646e50e..d5f6dc792 100644
--- a/src/math/numbertheory/dsa_gen.cpp
+++ b/src/math/numbertheory/dsa_gen.cpp
@@ -54,7 +54,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
"Generating a DSA parameter set with a " + to_string(qbits) +
"long q requires a seed at least as many bits long");
- std::auto_ptr<HashFunction> hash(
+ std::unique_ptr<HashFunction> hash(
af.make_hash_function("SHA-" + to_string(qbits)));
const u32bit HASH_SIZE = hash->OUTPUT_LENGTH;
diff --git a/src/pubkey/ec_dompar/ec_dompar.cpp b/src/pubkey/ec_dompar/ec_dompar.cpp
index 6cfcc0619..c4634877e 100644
--- a/src/pubkey/ec_dompar/ec_dompar.cpp
+++ b/src/pubkey/ec_dompar/ec_dompar.cpp
@@ -545,7 +545,7 @@ EC_Domain_Params decode_ber_ec_dompar(SecureVector<byte> const& encoded)
BER_Decoder dec(encoded);
BER_Object obj = dec.get_next_object();
ASN1_Tag tag = obj.type_tag;
- std::auto_ptr<EC_Domain_Params> p_result;
+ std::unique_ptr<EC_Domain_Params> p_result;
if(tag == OBJECT_ID)
{
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp
index 9af63bdcd..bebfc3705 100644
--- a/src/pubkey/ecc_key/ecc_key.cpp
+++ b/src/pubkey/ecc_key/ecc_key.cpp
@@ -166,7 +166,7 @@ void EC_PrivateKey::generate_private_key(RandomNumberGenerator& rng)
BigInt tmp_private_value(0);
tmp_private_value = BigInt::random_integer(rng, 1, mp_dom_pars->get_order());
- mp_public_point = std::auto_ptr<PointGFp>( new PointGFp (mp_dom_pars->get_base_point()));
+ mp_public_point = std::unique_ptr<PointGFp>( new PointGFp (mp_dom_pars->get_base_point()));
mp_public_point->mult_this_secure(tmp_private_value,
mp_dom_pars->get_order(),
mp_dom_pars->get_order()-1);
diff --git a/src/pubkey/ecc_key/ecc_key.h b/src/pubkey/ecc_key/ecc_key.h
index 0ca9a0e75..9d5f57d9f 100644
--- a/src/pubkey/ecc_key/ecc_key.h
+++ b/src/pubkey/ecc_key/ecc_key.h
@@ -103,8 +103,8 @@ class BOTAN_DLL EC_PublicKey : public virtual Public_Key
SecureVector<byte> m_enc_public_point; // stores the public point
- std::auto_ptr<EC_Domain_Params> mp_dom_pars;
- std::auto_ptr<PointGFp> mp_public_point;
+ std::unique_ptr<EC_Domain_Params> mp_dom_pars;
+ std::unique_ptr<PointGFp> mp_public_point;
EC_dompar_enc m_param_enc;
};
diff --git a/src/pubkey/ecdsa/ecdsa.cpp b/src/pubkey/ecdsa/ecdsa.cpp
index 9640c6397..3e3bbf38a 100644
--- a/src/pubkey/ecdsa/ecdsa.cpp
+++ b/src/pubkey/ecdsa/ecdsa.cpp
@@ -20,7 +20,7 @@ namespace Botan {
ECDSA_PrivateKey::ECDSA_PrivateKey(RandomNumberGenerator& rng,
const EC_Domain_Params& dom_pars)
{
- mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars));
+ mp_dom_pars = std::unique_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars));
generate_private_key(rng);
try
@@ -68,11 +68,10 @@ void ECDSA_PublicKey::set_domain_parameters(const EC_Domain_Params& dom_pars)
throw Invalid_State("EC_PublicKey::set_domain_parameters(): point does not lie on provided curve");
}
- std::auto_ptr<EC_Domain_Params> p_tmp_pars(new EC_Domain_Params(dom_pars));
- ECDSA_Core tmp_ecdsa_core(*p_tmp_pars, BigInt(0), tmp_pp);
+ mp_dom_pars.reset(new EC_Domain_Params(dom_pars));
+ ECDSA_Core tmp_ecdsa_core(*mp_dom_pars, BigInt(0), tmp_pp);
mp_public_point.reset(new PointGFp(tmp_pp));
m_ecdsa_core = tmp_ecdsa_core;
- mp_dom_pars = p_tmp_pars;
}
void ECDSA_PublicKey::set_all_values(const ECDSA_PublicKey& other)
@@ -131,8 +130,8 @@ bool ECDSA_PublicKey::verify(const byte message[],
ECDSA_PublicKey::ECDSA_PublicKey(const EC_Domain_Params& dom_par,
const PointGFp& public_point)
{
- mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_par));
- mp_public_point = std::auto_ptr<PointGFp>(new PointGFp(public_point));
+ mp_dom_pars = std::unique_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_par));
+ mp_public_point = std::unique_ptr<PointGFp>(new PointGFp(public_point));
m_param_enc = ENC_EXPLICIT;
m_ecdsa_core = ECDSA_Core(*mp_dom_pars, BigInt(0), *mp_public_point);
}
diff --git a/src/pubkey/eckaeg/eckaeg.cpp b/src/pubkey/eckaeg/eckaeg.cpp
index 0d094e2e1..1b315d101 100644
--- a/src/pubkey/eckaeg/eckaeg.cpp
+++ b/src/pubkey/eckaeg/eckaeg.cpp
@@ -63,8 +63,8 @@ void ECKAEG_PublicKey::X509_load_hook()
ECKAEG_PublicKey::ECKAEG_PublicKey(EC_Domain_Params const& dom_par, PointGFp const& public_point)
{
- mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_par));
- mp_public_point = std::auto_ptr<PointGFp>(new PointGFp(public_point));
+ mp_dom_pars = std::unique_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_par));
+ mp_public_point = std::unique_ptr<PointGFp>(new PointGFp(public_point));
if(mp_public_point->get_curve() != mp_dom_pars->get_curve())
{
throw Invalid_Argument("ECKAEG_PublicKey(): curve of arg. point and curve of arg. domain parameters are different");
diff --git a/src/pubkey/eckaeg/eckaeg.h b/src/pubkey/eckaeg/eckaeg.h
index 31b65740c..053a40e4f 100644
--- a/src/pubkey/eckaeg/eckaeg.h
+++ b/src/pubkey/eckaeg/eckaeg.h
@@ -89,7 +89,7 @@ class BOTAN_DLL ECKAEG_PrivateKey : public ECKAEG_PublicKey,
ECKAEG_PrivateKey(RandomNumberGenerator& rng,
const EC_Domain_Params& dom_pars)
{
- mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars));
+ mp_dom_pars = std::unique_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars));
generate_private_key(rng);
mp_public_point->check_invariants();
m_eckaeg_core = ECKAEG_Core(*mp_dom_pars, m_private_value, *mp_public_point);
diff --git a/src/pubkey/keypair/keypair.cpp b/src/pubkey/keypair/keypair.cpp
index 486577fc5..7eaa33395 100644
--- a/src/pubkey/keypair/keypair.cpp
+++ b/src/pubkey/keypair/keypair.cpp
@@ -22,8 +22,8 @@ void check_key(RandomNumberGenerator& rng,
if(encryptor->maximum_input_size() == 0)
return;
- std::auto_ptr<PK_Encryptor> enc(encryptor);
- std::auto_ptr<PK_Decryptor> dec(decryptor);
+ std::unique_ptr<PK_Encryptor> enc(encryptor);
+ std::unique_ptr<PK_Decryptor> dec(decryptor);
SecureVector<byte> message(enc->maximum_input_size() - 1);
rng.randomize(message, message.size());
@@ -43,8 +43,8 @@ void check_key(RandomNumberGenerator& rng,
void check_key(RandomNumberGenerator& rng,
PK_Signer* signer, PK_Verifier* verifier)
{
- std::auto_ptr<PK_Signer> sig(signer);
- std::auto_ptr<PK_Verifier> ver(verifier);
+ std::unique_ptr<PK_Signer> sig(signer);
+ std::unique_ptr<PK_Verifier> ver(verifier);
SecureVector<byte> message(16);
rng.randomize(message, message.size());
diff --git a/src/pubkey/pubkey/pkcs8.cpp b/src/pubkey/pubkey/pkcs8.cpp
index 8a464ecfe..87f05da92 100644
--- a/src/pubkey/pubkey/pkcs8.cpp
+++ b/src/pubkey/pubkey/pkcs8.cpp
@@ -89,7 +89,7 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui,
if(is_encrypted)
{
DataSource_Memory params(pbe_alg_id.parameters);
- std::auto_ptr<PBE> pbe(get_pbe(pbe_alg_id.oid, params));
+ std::unique_ptr<PBE> pbe(get_pbe(pbe_alg_id.oid, params));
User_Interface::UI_Result result = User_Interface::OK;
const std::string passphrase =
@@ -138,7 +138,7 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui,
*/
void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding)
{
- std::auto_ptr<PKCS8_Encoder> encoder(key.pkcs8_encoder());
+ std::unique_ptr<PKCS8_Encoder> encoder(key.pkcs8_encoder());
if(!encoder.get())
throw Encoding_Error("PKCS8::encode: Key does not support encoding");
@@ -175,7 +175,7 @@ void encrypt_key(const Private_Key& key,
encode(key, raw_key, RAW_BER);
raw_key.end_msg();
- std::auto_ptr<PBE> pbe(get_pbe(((pbe_algo != "") ? pbe_algo : DEFAULT_PBE)));
+ std::unique_ptr<PBE> pbe(get_pbe(((pbe_algo != "") ? pbe_algo : DEFAULT_PBE)));
pbe->new_params(rng);
pbe->set_key(pass);
@@ -244,13 +244,13 @@ Private_Key* load_key(DataSource& source,
throw PKCS8_Exception("Unknown algorithm OID: " +
alg_id.oid.as_string());
- std::auto_ptr<Private_Key> key(get_private_key(alg_name));
+ std::unique_ptr<Private_Key> key(get_private_key(alg_name));
if(!key.get())
throw PKCS8_Exception("Unknown PK algorithm/OID: " + alg_name + ", " +
alg_id.oid.as_string());
- std::auto_ptr<PKCS8_Decoder> decoder(key->pkcs8_decoder(rng));
+ std::unique_ptr<PKCS8_Decoder> decoder(key->pkcs8_decoder(rng));
if(!decoder.get())
throw Decoding_Error("Key does not support PKCS #8 decoding");
diff --git a/src/pubkey/pubkey/x509_key.cpp b/src/pubkey/pubkey/x509_key.cpp
index 455e627f3..f1fc59410 100644
--- a/src/pubkey/pubkey/x509_key.cpp
+++ b/src/pubkey/pubkey/x509_key.cpp
@@ -24,7 +24,7 @@ namespace X509 {
*/
void encode(const Public_Key& key, Pipe& pipe, X509_Encoding encoding)
{
- std::auto_ptr<X509_Encoder> encoder(key.x509_encoder());
+ std::unique_ptr<X509_Encoder> encoder(key.x509_encoder());
if(!encoder.get())
throw Encoding_Error("X509::encode: Key does not support encoding");
@@ -94,12 +94,12 @@ Public_Key* load_key(DataSource& source)
throw Decoding_Error("Unknown algorithm OID: " +
alg_id.oid.as_string());
- std::auto_ptr<Public_Key> key_obj(get_public_key(alg_name));
+ std::unique_ptr<Public_Key> key_obj(get_public_key(alg_name));
if(!key_obj.get())
throw Decoding_Error("Unknown PK algorithm/OID: " + alg_name + ", " +
alg_id.oid.as_string());
- std::auto_ptr<X509_Decoder> decoder(key_obj->x509_decoder());
+ std::unique_ptr<X509_Decoder> decoder(key_obj->x509_decoder());
if(!decoder.get())
throw Decoding_Error("Key does not support X.509 decoding");