aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-08 15:45:43 +0000
committerlloyd <[email protected]>2010-03-08 15:45:43 +0000
commit868c7f7d9c306e6e15d24f2b32e529aa1956516e (patch)
tree2d179e2ff08144c63ad5d7462cd5923524a92d33 /src
parent8a47f6f2bbf169a2ea0853234f81b49070c770df (diff)
Rename PK_Encryptor_MR_with_EME and PK_Decryptor_MR_with_EME to
PK_Encryptor_EME and PK_Decryptor_EME; the message recovery is somewhat implicit in the recovery of the plaintext.
Diffstat (limited to 'src')
-rw-r--r--src/cms/cms_ealg.cpp2
-rw-r--r--src/libstate/look_pk.h4
-rw-r--r--src/pubkey/elgamal/elgamal.cpp4
-rw-r--r--src/pubkey/pubkey.cpp32
-rw-r--r--src/pubkey/pubkey.h42
-rw-r--r--src/ssl/c_kex.cpp4
6 files changed, 45 insertions, 43 deletions
diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp
index 0cfdbba82..3ddf8a39e 100644
--- a/src/cms/cms_ealg.cpp
+++ b/src/cms/cms_ealg.cpp
@@ -131,7 +131,7 @@ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng,
const std::string padding = "EME-PKCS1-v1_5";
const std::string pk_algo = pub_key->algo_name();
- PK_Encryptor_MR_with_EME encryptor(*pub_key, padding);
+ PK_Encryptor_EME encryptor(*pub_key, padding);
SymmetricKey cek = setup_key(rng, cipher);
diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h
index 59fe7d8c8..833b28f67 100644
--- a/src/libstate/look_pk.h
+++ b/src/libstate/look_pk.h
@@ -22,7 +22,7 @@ namespace Botan {
inline PK_Encryptor* get_pk_encryptor(const Public_Key& key,
const std::string& eme)
{
- return new PK_Encryptor_MR_with_EME(key, eme);
+ return new PK_Encryptor_EME(key, eme);
}
/**
@@ -34,7 +34,7 @@ inline PK_Encryptor* get_pk_encryptor(const Public_Key& key,
inline PK_Decryptor* get_pk_decryptor(const Private_Key& key,
const std::string& eme)
{
- return new PK_Decryptor_MR_with_EME(key, eme);
+ return new PK_Decryptor_EME(key, eme);
}
/**
diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp
index 6b919d916..fe83b3b2b 100644
--- a/src/pubkey/elgamal/elgamal.cpp
+++ b/src/pubkey/elgamal/elgamal.cpp
@@ -65,8 +65,8 @@ bool ElGamal_PrivateKey::check_key(RandomNumberGenerator& rng,
try
{
- PK_Encryptor_MR_with_EME this_encryptor(*this, "EME1(SHA-1)");
- PK_Decryptor_MR_with_EME this_decryptor(*this, "EME1(SHA-1)");
+ PK_Encryptor_EME this_encryptor(*this, "EME1(SHA-1)");
+ PK_Decryptor_EME this_decryptor(*this, "EME1(SHA-1)");
KeyPair::check_key(rng,
this_encryptor,
diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp
index 7426292ce..5b6c7cd45 100644
--- a/src/pubkey/pubkey.cpp
+++ b/src/pubkey/pubkey.cpp
@@ -19,10 +19,10 @@
namespace Botan {
/*
-* PK_Encryptor_MR_with_EME Constructor
+* PK_Encryptor_EME Constructor
*/
-PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key,
- const std::string& eme_name)
+PK_Encryptor_EME::PK_Encryptor_EME(const Public_Key& key,
+ const std::string& eme_name)
{
Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
@@ -34,7 +34,7 @@ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key,
}
if(op == 0)
- throw Lookup_Error("PK_Encryptor_MR_with_EME: No working engine for " +
+ throw Lookup_Error("PK_Encryptor_EME: No working engine for " +
key.algo_name());
eme = get_eme(eme_name);
@@ -44,9 +44,9 @@ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key,
* Encrypt a message
*/
SecureVector<byte>
-PK_Encryptor_MR_with_EME::enc(const byte msg[],
- u32bit length,
- RandomNumberGenerator& rng) const
+PK_Encryptor_EME::enc(const byte msg[],
+ u32bit length,
+ RandomNumberGenerator& rng) const
{
SecureVector<byte> message;
if(eme)
@@ -55,7 +55,7 @@ PK_Encryptor_MR_with_EME::enc(const byte msg[],
message.set(msg, length);
if(8*(message.size() - 1) + high_bit(message[0]) > op->max_input_bits())
- throw Invalid_Argument("PK_Encryptor_MR_with_EME: Input is too large");
+ throw Invalid_Argument("PK_Encryptor_EME: Input is too large");
return op->encrypt(message, message.size(), rng);
}
@@ -63,7 +63,7 @@ PK_Encryptor_MR_with_EME::enc(const byte msg[],
/*
* Return the max size, in bytes, of a message
*/
-u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const
+u32bit PK_Encryptor_EME::maximum_input_size() const
{
if(!eme)
return (op->max_input_bits() / 8);
@@ -72,10 +72,10 @@ u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const
}
/*
-* PK_Decryptor_MR_with_EME Constructor
+* PK_Decryptor_EME Constructor
*/
-PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key,
- const std::string& eme_name)
+PK_Decryptor_EME::PK_Decryptor_EME(const Private_Key& key,
+ const std::string& eme_name)
{
Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory());
@@ -87,7 +87,7 @@ PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key,
}
if(op == 0)
- throw Lookup_Error("PK_Decryptor_MR_with_EME: No working engine for " +
+ throw Lookup_Error("PK_Decryptor_EME: No working engine for " +
key.algo_name());
eme = get_eme(eme_name);
@@ -96,8 +96,8 @@ PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key,
/*
* Decrypt a message
*/
-SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[],
- u32bit length) const
+SecureVector<byte> PK_Decryptor_EME::dec(const byte msg[],
+ u32bit length) const
{
try {
SecureVector<byte> decrypted = op->decrypt(msg, length);
@@ -108,7 +108,7 @@ SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[],
}
catch(Invalid_Argument)
{
- throw Decoding_Error("PK_Decryptor_MR_with_EME: Input is invalid");
+ throw Decoding_Error("PK_Decryptor_EME: Input is invalid");
}
}
diff --git a/src/pubkey/pubkey.h b/src/pubkey/pubkey.h
index c65ecd468..a262b51fe 100644
--- a/src/pubkey/pubkey.h
+++ b/src/pubkey/pubkey.h
@@ -61,8 +61,12 @@ class BOTAN_DLL PK_Encryptor
*/
virtual u32bit maximum_input_size() const = 0;
+ PK_Encryptor() {}
virtual ~PK_Encryptor() {}
private:
+ PK_Encryptor(const PK_Encryptor&) {}
+ PK_Encryptor& operator=(const PK_Encryptor&) { return *this; }
+
virtual SecureVector<byte> enc(const byte[], u32bit,
RandomNumberGenerator&) const = 0;
};
@@ -94,8 +98,12 @@ class BOTAN_DLL PK_Decryptor
return dec(&in[0], in.size());
}
+ PK_Decryptor() {}
virtual ~PK_Decryptor() {}
private:
+ PK_Decryptor(const PK_Decryptor&) {}
+ PK_Decryptor& operator=(const PK_Decryptor&) { return *this; }
+
virtual SecureVector<byte> dec(const byte[], u32bit) const = 0;
};
@@ -173,8 +181,8 @@ class BOTAN_DLL PK_Signer
~PK_Signer() { delete op; delete emsa; }
private:
- PK_Signer(const PK_Signer&);
- PK_Signer& operator=(const PK_Signer&);
+ PK_Signer(const PK_Signer&) {}
+ PK_Signer& operator=(const PK_Signer&) { return *this; }
PK_Ops::Signature* op;
EMSA* emsa;
@@ -272,8 +280,8 @@ class BOTAN_DLL PK_Verifier
~PK_Verifier() { delete op; delete emsa; }
private:
- PK_Verifier(const PK_Verifier&);
- PK_Verifier& operator=(const PK_Verifier&);
+ PK_Verifier(const PK_Verifier&) {}
+ PK_Verifier& operator=(const PK_Verifier&) { return *this; }
bool validate_signature(const MemoryRegion<byte>& msg,
const byte sig[], u32bit sig_len);
@@ -362,8 +370,8 @@ class BOTAN_DLL PK_Key_Agreement
~PK_Key_Agreement() { delete op; delete kdf; }
private:
- PK_Key_Agreement(const PK_Key_Agreement_Key&);
- PK_Key_Agreement& operator=(const PK_Key_Agreement&);
+ PK_Key_Agreement(const PK_Key_Agreement_Key&) {}
+ PK_Key_Agreement& operator=(const PK_Key_Agreement&) { return *this; }
PK_Ops::Key_Agreement* op;
KDF* kdf;
@@ -372,7 +380,7 @@ class BOTAN_DLL PK_Key_Agreement
/**
* Encryption with an MR algorithm and an EME.
*/
-class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor
+class BOTAN_DLL PK_Encryptor_EME : public PK_Encryptor
{
public:
u32bit maximum_input_size() const;
@@ -382,14 +390,11 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor
* @param key the key to use inside the decryptor
* @param eme the EME to use
*/
- PK_Encryptor_MR_with_EME(const Public_Key& key,
- const std::string& eme);
+ PK_Encryptor_EME(const Public_Key& key,
+ const std::string& eme);
- ~PK_Encryptor_MR_with_EME() { delete op; delete eme; }
+ ~PK_Encryptor_EME() { delete op; delete eme; }
private:
- PK_Encryptor_MR_with_EME(const PK_Encryptor_MR_with_EME&);
- PK_Encryptor_MR_with_EME& operator=(const PK_Encryptor_MR_with_EME&);
-
SecureVector<byte> enc(const byte[], u32bit,
RandomNumberGenerator& rng) const;
@@ -400,7 +405,7 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor
/**
* Decryption with an MR algorithm and an EME.
*/
-class BOTAN_DLL PK_Decryptor_MR_with_EME : public PK_Decryptor
+class BOTAN_DLL PK_Decryptor_EME : public PK_Decryptor
{
public:
/**
@@ -408,14 +413,11 @@ class BOTAN_DLL PK_Decryptor_MR_with_EME : public PK_Decryptor
* @param key the key to use inside the encryptor
* @param eme the EME to use
*/
- PK_Decryptor_MR_with_EME(const Private_Key& key,
- const std::string& eme);
+ PK_Decryptor_EME(const Private_Key& key,
+ const std::string& eme);
- ~PK_Decryptor_MR_with_EME() { delete op; delete eme; }
+ ~PK_Decryptor_EME() { delete op; delete eme; }
private:
- PK_Decryptor_MR_with_EME(const PK_Decryptor_MR_with_EME&);
- PK_Decryptor_MR_with_EME& operator=(const PK_Decryptor_MR_with_EME&);
-
SecureVector<byte> dec(const byte[], u32bit) const;
const PK_Ops::Decryption* op;
diff --git a/src/ssl/c_kex.cpp b/src/ssl/c_kex.cpp
index 7140bf35c..9e59beefc 100644
--- a/src/ssl/c_kex.cpp
+++ b/src/ssl/c_kex.cpp
@@ -44,7 +44,7 @@ Client_Key_Exchange::Client_Key_Exchange(RandomNumberGenerator& rng,
pre_master[0] = (pref_version >> 8) & 0xFF;
pre_master[1] = (pref_version ) & 0xFF;
- PK_Encryptor_MR_with_EME encryptor(*rsa_pub, "PKCS1v15");
+ PK_Encryptor_EME encryptor(*rsa_pub, "PKCS1v15");
key_material = encryptor.encrypt(pre_master, rng);
@@ -138,7 +138,7 @@ Client_Key_Exchange::pre_master_secret(RandomNumberGenerator& rng,
}
else if(const RSA_PrivateKey* rsa_priv = dynamic_cast<const RSA_PrivateKey*>(priv_key))
{
- PK_Decryptor_MR_with_EME decryptor(*rsa_priv, "PKCS1v15");
+ PK_Decryptor_EME decryptor(*rsa_priv, "PKCS1v15");
try {
pre_master = decryptor.decrypt(key_material);