diff options
author | Jack Lloyd <[email protected]> | 2016-11-02 15:05:46 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-03 11:57:10 -0400 |
commit | 8d50c82b43b34b70d19b0faaeab6b37f2eae066c (patch) | |
tree | 9cb7478fb7c37c66e140bc09ca77bf0ede07cc76 /src/lib/pubkey/pk_keys.cpp | |
parent | b1021ca76bb3c47b1b520421ccece38d772e5907 (diff) |
Remove automatic self-testing of public and private keys
Rarely expected and often causes performance problems, especially for private keys.
Instead applications should call check_key explicitly to validate keys when
necessary.
Note this removal doesn't apply to tests like ECDH on-the-curve tests, where a check
on the public key is required for security of our own key.
Updates most APIs to remove RNG calls, where they are no longer required. Exception
is PKCS8 interface, pending further work there (see GH #685) it just ignores the RNG
argument now.
Diffstat (limited to 'src/lib/pubkey/pk_keys.cpp')
-rw-r--r-- | src/lib/pubkey/pk_keys.cpp | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/lib/pubkey/pk_keys.cpp b/src/lib/pubkey/pk_keys.cpp index 2c846d623..22b8cf0c0 100644 --- a/src/lib/pubkey/pk_keys.cpp +++ b/src/lib/pubkey/pk_keys.cpp @@ -29,33 +29,6 @@ OID Public_Key::get_oid() const } /* -* Run checks on a loaded public key -*/ -void Public_Key::load_check(RandomNumberGenerator& rng) const - { - if(!check_key(rng, BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD)) - throw Invalid_Argument("Invalid public key"); - } - -/* -* Run checks on a loaded private key -*/ -void Private_Key::load_check(RandomNumberGenerator& rng) const - { - if(!check_key(rng, BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_LOAD)) - throw Invalid_Argument("Invalid private key"); - } - -/* -* Run checks on a generated private key -*/ -void Private_Key::gen_check(RandomNumberGenerator& rng) const - { - if(!check_key(rng, BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_GENERATE)) - throw Self_Test_Failure("Private key generation failed"); - } - -/* * Hash of the PKCS #8 encoding for this key object */ std::string Private_Key::fingerprint(const std::string& alg) const |