diff options
Diffstat (limited to 'src/pk')
-rw-r--r-- | src/pk/pubkey/info.txt | 3 | ||||
-rw-r--r-- | src/pk/pubkey/kdf.cpp | 70 | ||||
-rw-r--r-- | src/pk/pubkey/pk_util.cpp | 48 | ||||
-rw-r--r-- | src/pk/pubkey/pk_util.h | 92 | ||||
-rw-r--r-- | src/pk/pubkey/pkcs8.cpp | 2 | ||||
-rw-r--r-- | src/pk/pubkey/pubkey.h | 2 |
6 files changed, 2 insertions, 215 deletions
diff --git a/src/pk/pubkey/info.txt b/src/pk/pubkey/info.txt index ecb6ce2d1..ebcb4eb0e 100644 --- a/src/pk/pubkey/info.txt +++ b/src/pk/pubkey/info.txt @@ -14,7 +14,6 @@ asn1 dh_op.cpp dsa_op.cpp elg_op.cpp -kdf.cpp nr_op.cpp pk_algs.cpp pk_algs.h @@ -23,8 +22,6 @@ pk_core.h pk_keys.cpp pk_keys.h pk_ops.h -pk_util.cpp -pk_util.h pkcs8.cpp pkcs8.h pubkey.cpp diff --git a/src/pk/pubkey/kdf.cpp b/src/pk/pubkey/kdf.cpp deleted file mode 100644 index dca56e1a6..000000000 --- a/src/pk/pubkey/kdf.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************* -* KDF Base Class Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/pk_util.h> -#include <botan/lookup.h> -#include <botan/loadstor.h> -#include <algorithm> -#include <memory> - -namespace Botan { - -/************************************************* -* Derive a key * -*************************************************/ -SecureVector<byte> KDF::derive_key(u32bit key_len, - const MemoryRegion<byte>& secret, - const std::string& salt) const - { - return derive_key(key_len, secret, secret.size(), - reinterpret_cast<const byte*>(salt.data()), - salt.length()); - } - -/************************************************* -* Derive a key * -*************************************************/ -SecureVector<byte> KDF::derive_key(u32bit key_len, - const MemoryRegion<byte>& secret, - const byte salt[], u32bit salt_len) const - { - return derive_key(key_len, secret.begin(), secret.size(), - salt, salt_len); - } - -/************************************************* -* Derive a key * -*************************************************/ -SecureVector<byte> KDF::derive_key(u32bit key_len, - const MemoryRegion<byte>& secret, - const MemoryRegion<byte>& salt) const - { - return derive_key(key_len, secret.begin(), secret.size(), - salt.begin(), salt.size()); - } - -/************************************************* -* Derive a key * -*************************************************/ -SecureVector<byte> KDF::derive_key(u32bit key_len, - const byte secret[], u32bit secret_len, - const std::string& salt) const - { - return derive_key(key_len, secret, secret_len, - reinterpret_cast<const byte*>(salt.data()), - salt.length()); - } - -/************************************************* -* Derive a key * -*************************************************/ -SecureVector<byte> KDF::derive_key(u32bit key_len, - const byte secret[], u32bit secret_len, - const byte salt[], u32bit salt_len) const - { - return derive(key_len, secret, secret_len, salt, salt_len); - } - -} diff --git a/src/pk/pubkey/pk_util.cpp b/src/pk/pubkey/pk_util.cpp deleted file mode 100644 index 1976436ea..000000000 --- a/src/pk/pubkey/pk_util.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************* -* PK Utility Classes Source File * -* (C) 1999-2008 Jack Lloyd * -*************************************************/ - -#include <botan/pk_util.h> - -namespace Botan { - -/************************************************* -* Encode a message * -*************************************************/ -SecureVector<byte> EME::encode(const byte msg[], u32bit msg_len, - u32bit key_bits, - RandomNumberGenerator& rng) const - { - return pad(msg, msg_len, key_bits, rng); - } - -/************************************************* -* Encode a message * -*************************************************/ -SecureVector<byte> EME::encode(const MemoryRegion<byte>& msg, - u32bit key_bits, - RandomNumberGenerator& rng) const - { - return pad(msg, msg.size(), key_bits, rng); - } - -/************************************************* -* Decode a message * -*************************************************/ -SecureVector<byte> EME::decode(const byte msg[], u32bit msg_len, - u32bit key_bits) const - { - return unpad(msg, msg_len, key_bits); - } - -/************************************************* -* Decode a message * -*************************************************/ -SecureVector<byte> EME::decode(const MemoryRegion<byte>& msg, - u32bit key_bits) const - { - return unpad(msg, msg.size(), key_bits); - } - -} diff --git a/src/pk/pubkey/pk_util.h b/src/pk/pubkey/pk_util.h deleted file mode 100644 index aa7a71234..000000000 --- a/src/pk/pubkey/pk_util.h +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************* -* PK Utility Classes Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_PUBKEY_UTIL_H__ -#define BOTAN_PUBKEY_UTIL_H__ - -#include <botan/base.h> -#include <botan/rng.h> - -namespace Botan { - -/************************************************* -* Encoding Method for Encryption * -*************************************************/ -class BOTAN_DLL EME - { - public: - virtual u32bit maximum_input_size(u32bit) const = 0; - - SecureVector<byte> encode(const byte[], u32bit, u32bit, - RandomNumberGenerator&) const; - SecureVector<byte> encode(const MemoryRegion<byte>&, u32bit, - RandomNumberGenerator&) const; - - SecureVector<byte> decode(const byte[], u32bit, u32bit) const; - SecureVector<byte> decode(const MemoryRegion<byte>&, u32bit) const; - - virtual ~EME() {} - private: - virtual SecureVector<byte> pad(const byte[], u32bit, u32bit, - RandomNumberGenerator&) const = 0; - - virtual SecureVector<byte> unpad(const byte[], u32bit, u32bit) const = 0; - }; - -/************************************************* -* Encoding Method for Signatures, Appendix * -*************************************************/ -class BOTAN_DLL EMSA - { - public: - virtual void update(const byte[], u32bit) = 0; - virtual SecureVector<byte> raw_data() = 0; - - virtual SecureVector<byte> encoding_of(const MemoryRegion<byte>&, - u32bit, - RandomNumberGenerator& rng) = 0; - - virtual bool verify(const MemoryRegion<byte>&, const MemoryRegion<byte>&, - u32bit) throw() = 0; - virtual ~EMSA() {} - }; - -/************************************************* -* Key Derivation Function * -*************************************************/ -class BOTAN_DLL KDF - { - public: - SecureVector<byte> derive_key(u32bit, const MemoryRegion<byte>&, - const std::string& = "") const; - SecureVector<byte> derive_key(u32bit, const MemoryRegion<byte>&, - const MemoryRegion<byte>&) const; - SecureVector<byte> derive_key(u32bit, const MemoryRegion<byte>&, - const byte[], u32bit) const; - - SecureVector<byte> derive_key(u32bit, const byte[], u32bit, - const std::string& = "") const; - SecureVector<byte> derive_key(u32bit, const byte[], u32bit, - const byte[], u32bit) const; - - virtual ~KDF() {} - private: - virtual SecureVector<byte> derive(u32bit, const byte[], u32bit, - const byte[], u32bit) const = 0; - }; - -/************************************************* -* Mask Generation Function * -*************************************************/ -class BOTAN_DLL MGF - { - public: - virtual void mask(const byte[], u32bit, byte[], u32bit) const = 0; - virtual ~MGF() {} - }; - -} - -#endif diff --git a/src/pk/pubkey/pkcs8.cpp b/src/pk/pubkey/pkcs8.cpp index 2963c9d86..a79a616a2 100644 --- a/src/pk/pubkey/pkcs8.cpp +++ b/src/pk/pubkey/pkcs8.cpp @@ -4,13 +4,13 @@ *************************************************/ #include <botan/pkcs8.h> +#include <botan/get_pbe.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/asn1_obj.h> #include <botan/pk_algs.h> #include <botan/oids.h> #include <botan/pem.h> -#include <botan/lookup.h> #include <memory> namespace Botan { diff --git a/src/pk/pubkey/pubkey.h b/src/pk/pubkey/pubkey.h index 0c9abf18f..52f14c5b3 100644 --- a/src/pk/pubkey/pubkey.h +++ b/src/pk/pubkey/pubkey.h @@ -8,7 +8,7 @@ #include <botan/base.h> #include <botan/pk_keys.h> -#include <botan/pk_util.h> +#include <botan/pk_pad.h> namespace Botan { |