aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-20 11:24:33 +0000
committerlloyd <[email protected]>2008-06-20 11:24:33 +0000
commit79c7591a0946bb20fd50de136970cc0b1454430a (patch)
tree4efe62dfcd3f786970cf24062d06061275aead86 /include
parent850af952f95a3115e509ebd0aa6689a1d2e9c810 (diff)
Convert pkcs8_decoder() and x509_decoder() to take a RandomNumberGenerator&
reference, along with PKCS8::load_key get_pbe no longer calls new_params() on the newly instantiated instance, which is not backwards compatible (you have to either call new_params yourself, or explicitly set the iteration count, salt, etc)
Diffstat (limited to 'include')
-rw-r--r--include/dl_algo.h4
-rw-r--r--include/if_algo.h4
-rw-r--r--include/pk_keys.h14
-rw-r--r--include/pkcs8.h21
4 files changed, 27 insertions, 16 deletions
diff --git a/include/dl_algo.h b/include/dl_algo.h
index f0bdf9049..f74deb34f 100644
--- a/include/dl_algo.h
+++ b/include/dl_algo.h
@@ -29,7 +29,7 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key
virtual DL_Group::Format group_format() const = 0;
X509_Encoder* x509_encoder() const;
- X509_Decoder* x509_decoder();
+ X509_Decoder* x509_decoder(RandomNumberGenerator&);
protected:
BigInt y;
DL_Group group;
@@ -49,7 +49,7 @@ class BOTAN_DLL DL_Scheme_PrivateKey : public virtual DL_Scheme_PublicKey,
const BigInt& get_x() const { return x; }
PKCS8_Encoder* pkcs8_encoder() const;
- PKCS8_Decoder* pkcs8_decoder();
+ PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&);
protected:
BigInt x;
private:
diff --git a/include/if_algo.h b/include/if_algo.h
index 2df8723a4..eb94c7dfe 100644
--- a/include/if_algo.h
+++ b/include/if_algo.h
@@ -26,7 +26,7 @@ class BOTAN_DLL IF_Scheme_PublicKey : public virtual Public_Key
u32bit max_input_bits() const { return (n.bits() - 1); }
X509_Encoder* x509_encoder() const;
- X509_Decoder* x509_decoder();
+ X509_Decoder* x509_decoder(RandomNumberGenerator&);
protected:
virtual void X509_load_hook(RandomNumberGenerator&);
BigInt n, e;
@@ -47,7 +47,7 @@ class BOTAN_DLL IF_Scheme_PrivateKey : public virtual IF_Scheme_PublicKey,
const BigInt& get_d() const { return d; }
PKCS8_Encoder* pkcs8_encoder() const;
- PKCS8_Decoder* pkcs8_decoder();
+ PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&);
protected:
virtual void PKCS8_load_hook(RandomNumberGenerator&, bool = false);
BigInt d, p, q, d1, d2, c;
diff --git a/include/pk_keys.h b/include/pk_keys.h
index ea79ab4ec..3c0951a1a 100644
--- a/include/pk_keys.h
+++ b/include/pk_keys.h
@@ -6,9 +6,9 @@
#ifndef BOTAN_PK_KEYS_H__
#define BOTAN_PK_KEYS_H__
-#include <botan/rng.h>
#include <botan/secmem.h>
#include <botan/asn1_oid.h>
+#include <botan/rng.h>
namespace Botan {
@@ -28,8 +28,10 @@ class BOTAN_DLL Public_Key
virtual u32bit message_part_size() const { return 0; }
virtual u32bit max_input_bits() const = 0;
- virtual class X509_Encoder* x509_encoder() const { return 0; }
- virtual class X509_Decoder* x509_decoder() { return 0; }
+ virtual class X509_Encoder* x509_encoder() const
+ { return 0; }
+ virtual class X509_Decoder* x509_decoder(RandomNumberGenerator&)
+ { return 0; }
virtual ~Public_Key() {}
protected:
@@ -42,8 +44,10 @@ class BOTAN_DLL Public_Key
class BOTAN_DLL Private_Key : public virtual Public_Key
{
public:
- virtual class PKCS8_Encoder* pkcs8_encoder() const { return 0; }
- virtual class PKCS8_Decoder* pkcs8_decoder() { return 0; }
+ virtual class PKCS8_Encoder* pkcs8_encoder() const
+ { return 0; }
+ virtual class PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&)
+ { return 0; }
protected:
void load_check(RandomNumberGenerator&) const;
void gen_check(RandomNumberGenerator&) const;
diff --git a/include/pkcs8.h b/include/pkcs8.h
index aa36af30f..7ee0dd864 100644
--- a/include/pkcs8.h
+++ b/include/pkcs8.h
@@ -37,7 +37,7 @@ class BOTAN_DLL PKCS8_Decoder
/*************************************************
* PKCS #8 General Exception *
*************************************************/
-struct PKCS8_Exception : public Decoding_Error
+struct BOTAN_DLL PKCS8_Exception : public Decoding_Error
{
PKCS8_Exception(const std::string& error) :
Decoding_Error("PKCS #8: " + error) {}
@@ -50,19 +50,26 @@ namespace PKCS8 {
*************************************************/
BOTAN_DLL void encode(const Private_Key&, Pipe&, X509_Encoding = PEM);
BOTAN_DLL void encrypt_key(const Private_Key&, Pipe&, const std::string&,
- const std::string& = "", X509_Encoding = PEM);
+ const std::string& = "", X509_Encoding = PEM);
BOTAN_DLL std::string PEM_encode(const Private_Key&);
BOTAN_DLL std::string PEM_encode(const Private_Key&, const std::string&,
const std::string& = "");
-BOTAN_DLL Private_Key* load_key(DataSource&, const User_Interface&);
-BOTAN_DLL Private_Key* load_key(DataSource&, const std::string& = "");
+BOTAN_DLL Private_Key* load_key(DataSource&, RandomNumberGenerator&,
+ const User_Interface&);
+BOTAN_DLL Private_Key* load_key(DataSource&, RandomNumberGenerator&,
+ const std::string& = "");
-BOTAN_DLL Private_Key* load_key(const std::string&, const User_Interface&);
-BOTAN_DLL Private_Key* load_key(const std::string&, const std::string& = "");
+BOTAN_DLL Private_Key* load_key(const std::string&,
+ RandomNumberGenerator&,
+ const User_Interface&);
+BOTAN_DLL Private_Key* load_key(const std::string&,
+ RandomNumberGenerator&,
+ const std::string& = "");
-BOTAN_DLL Private_Key* copy_key(const Private_Key&);
+BOTAN_DLL Private_Key* copy_key(const Private_Key&,
+ RandomNumberGenerator& rng);
}