aboutsummaryrefslogtreecommitdiffstats
path: root/checks/ecdsa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'checks/ecdsa.cpp')
-rw-r--r--checks/ecdsa.cpp34
1 files changed, 17 insertions, 17 deletions
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");