aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pubkey.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-10-14 19:23:55 -0400
committerJack Lloyd <[email protected]>2015-10-14 19:23:55 -0400
commit4e90017c204d3297df1444af59337db89f8180d9 (patch)
treef5a54d34b13035a4fda1a0ec7fd27c3791f6080d /src/lib/pubkey/pubkey.h
parent4bfd5d6828f23e0eef04e5cf079c323274136499 (diff)
Expose providers for public key operations
For PK_Encryptor and company they are requested via a new provider param to the constructors. The speed command gets a --provider option so you can see benchmark results with the different versions.
Diffstat (limited to 'src/lib/pubkey/pubkey.h')
-rw-r--r--src/lib/pubkey/pubkey.h68
1 files changed, 38 insertions, 30 deletions
diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h
index 687485c68..67116a9ec 100644
--- a/src/lib/pubkey/pubkey.h
+++ b/src/lib/pubkey/pubkey.h
@@ -120,6 +120,19 @@ class BOTAN_DLL PK_Decryptor
class BOTAN_DLL PK_Signer
{
public:
+
+ /**
+ * Construct a PK Signer.
+ * @param key the key to use inside this signer
+ * @param emsa the EMSA to use
+ * An example would be "EMSA1(SHA-224)".
+ * @param format the signature format to use
+ */
+ PK_Signer(const Private_Key& key,
+ const std::string& emsa,
+ Signature_Format format = IEEE_1363,
+ const std::string& provider = "");
+
/**
* Sign a message.
* @param in the message to sign as a byte array
@@ -180,17 +193,6 @@ class BOTAN_DLL PK_Signer
* @param format the signature format to use
*/
void set_output_format(Signature_Format format) { m_sig_format = format; }
-
- /**
- * Construct a PK Signer.
- * @param key the key to use inside this signer
- * @param emsa the EMSA to use
- * An example would be "EMSA1(SHA-224)".
- * @param format the signature format to use
- */
- PK_Signer(const Private_Key& key,
- const std::string& emsa,
- Signature_Format format = IEEE_1363);
private:
std::unique_ptr<PK_Ops::Signature> m_op;
Signature_Format m_sig_format;
@@ -205,6 +207,17 @@ class BOTAN_DLL PK_Verifier
{
public:
/**
+ * Construct a PK Verifier.
+ * @param pub_key the public key to verify against
+ * @param emsa the EMSA to use (eg "EMSA3(SHA-1)")
+ * @param format the signature format to use
+ */
+ PK_Verifier(const Public_Key& pub_key,
+ const std::string& emsa,
+ Signature_Format format = IEEE_1363,
+ const std::string& provider = "");
+
+ /**
* Verify a signature.
* @param msg the message that the signature belongs to, as a byte array
* @param msg_length the length of the above byte array msg
@@ -278,15 +291,6 @@ class BOTAN_DLL PK_Verifier
*/
void set_input_format(Signature_Format format);
- /**
- * Construct a PK Verifier.
- * @param pub_key the public key to verify against
- * @param emsa the EMSA to use (eg "EMSA3(SHA-1)")
- * @param format the signature format to use
- */
- PK_Verifier(const Public_Key& pub_key,
- const std::string& emsa,
- Signature_Format format = IEEE_1363);
private:
std::unique_ptr<PK_Ops::Verification> m_op;
Signature_Format m_sig_format;
@@ -299,6 +303,13 @@ class BOTAN_DLL PK_Key_Agreement
{
public:
+ /**
+ * Construct a PK Key Agreement.
+ * @param key the key to use
+ * @param kdf name of the KDF to use (or 'Raw' for no KDF)
+ */
+ PK_Key_Agreement(const Private_Key& key, const std::string& kdf);
+
/*
* Perform Key Agreement Operation
* @param key_len the desired key output size
@@ -361,18 +372,13 @@ class BOTAN_DLL PK_Key_Agreement
params.length());
}
- /**
- * Construct a PK Key Agreement.
- * @param key the key to use
- * @param kdf name of the KDF to use (or 'Raw' for no KDF)
- */
- PK_Key_Agreement(const Private_Key& key, const std::string& kdf);
private:
std::unique_ptr<PK_Ops::Key_Agreement> m_op;
};
/**
-* Encryption with an MR algorithm and an EME.
+* Encryption using a standard message recovery algorithm like RSA or
+* ElGamal, paired with an encoding scheme like OAEP.
*/
class BOTAN_DLL PK_Encryptor_EME : public PK_Encryptor
{
@@ -382,10 +388,11 @@ class BOTAN_DLL PK_Encryptor_EME : public PK_Encryptor
/**
* Construct an instance.
* @param key the key to use inside the decryptor
- * @param eme the EME to use
+ * @param padding the message encoding scheme to use (eg "OAEP(SHA-256)")
*/
PK_Encryptor_EME(const Public_Key& key,
- const std::string& eme);
+ const std::string& padding,
+ const std::string& provider = "");
private:
std::vector<byte> enc(const byte[], size_t,
RandomNumberGenerator& rng) const override;
@@ -405,7 +412,8 @@ class BOTAN_DLL PK_Decryptor_EME : public PK_Decryptor
* @param eme the EME to use
*/
PK_Decryptor_EME(const Private_Key& key,
- const std::string& eme);
+ const std::string& eme,
+ const std::string& provider = "");
private:
secure_vector<byte> dec(const byte[], size_t) const override;