aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey/pk_keys.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pubkey/pk_keys.h')
-rw-r--r--src/pubkey/pk_keys.h84
1 files changed, 13 insertions, 71 deletions
diff --git a/src/pubkey/pk_keys.h b/src/pubkey/pk_keys.h
index 5b612577d..da73db0ee 100644
--- a/src/pubkey/pk_keys.h
+++ b/src/pubkey/pk_keys.h
@@ -10,6 +10,7 @@
#include <botan/secmem.h>
#include <botan/asn1_oid.h>
+#include <botan/alg_id.h>
#include <botan/rng.h>
namespace Botan {
@@ -61,17 +62,14 @@ class BOTAN_DLL Public_Key
virtual u32bit max_input_bits() const = 0;
/**
- * Get an X509 encoder that can be used to encode this key in X509 format.
- * @return an X509 encoder for this key
+ * @return X.509 AlgorithmIdentifier for this key
*/
- virtual class X509_Encoder* x509_encoder() const = 0;
+ virtual AlgorithmIdentifier algorithm_identifier() const = 0;
/**
- * Get an X509 decoder that can be used to set the values of this
- * key based on an X509 encoded key object.
- * @return an X509 decoder for this key
+ * @return X.509 subject key encoding for this key object
*/
- virtual class X509_Decoder* x509_decoder() = 0;
+ virtual MemoryVector<byte> x509_subject_public_key() const = 0;
virtual ~Public_Key() {}
protected:
@@ -85,86 +83,30 @@ class BOTAN_DLL Private_Key : public virtual Public_Key
{
public:
/**
- * Get a PKCS#8 encoder that can be used to encode this key in
- * PKCS#8 format.
- * @return an PKCS#8 encoder for this key
+ * @return PKCS #8 private key encoding for this key object
*/
- virtual class PKCS8_Encoder* pkcs8_encoder() const
- { return 0; }
+ virtual MemoryVector<byte> pkcs8_private_key() const = 0;
/**
- * Get an PKCS#8 decoder that can be used to set the values of this key
- * based on an PKCS#8 encoded key object.
- * @return an PKCS#8 decoder for this key
+ * @return PKCS #8 AlgorithmIdentifier for this key
+ * Might be different from the X.509 identifier, but normally is not
*/
- virtual class PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&)
- { return 0; }
+ virtual AlgorithmIdentifier pkcs8_algorithm_identifier() const
+ { return algorithm_identifier(); }
+
protected:
void load_check(RandomNumberGenerator&) const;
void gen_check(RandomNumberGenerator&) const;
};
/**
-* PK Encrypting Key.
-*/
-class BOTAN_DLL PK_Encrypting_Key : public virtual Public_Key
- {
- public:
- virtual SecureVector<byte> encrypt(const byte[], u32bit,
- RandomNumberGenerator&) const = 0;
- virtual ~PK_Encrypting_Key() {}
- };
-
-/**
-* PK Decrypting Key
-*/
-class BOTAN_DLL PK_Decrypting_Key : public virtual Private_Key
- {
- public:
- virtual SecureVector<byte> decrypt(const byte[], u32bit) const = 0;
- virtual ~PK_Decrypting_Key() {}
- };
-
-/**
-* PK Signing Key
-*/
-class BOTAN_DLL PK_Signing_Key : public virtual Private_Key
- {
- public:
- virtual SecureVector<byte> sign(const byte[], u32bit,
- RandomNumberGenerator& rng) const = 0;
- virtual ~PK_Signing_Key() {}
- };
-
-/**
-* PK Verifying Key, Message Recovery Version
-*/
-class BOTAN_DLL PK_Verifying_with_MR_Key : public virtual Public_Key
- {
- public:
- virtual SecureVector<byte> verify(const byte[], u32bit) const = 0;
- virtual ~PK_Verifying_with_MR_Key() {}
- };
-
-/**
-* PK Verifying Key, No Message Recovery Version
-*/
-class BOTAN_DLL PK_Verifying_wo_MR_Key : public virtual Public_Key
- {
- public:
- virtual bool verify(const byte[], u32bit,
- const byte[], u32bit) const = 0;
- virtual ~PK_Verifying_wo_MR_Key() {}
- };
-
-/**
* PK Secret Value Derivation Key
*/
class BOTAN_DLL PK_Key_Agreement_Key : public virtual Private_Key
{
public:
- virtual SecureVector<byte> derive_key(const byte[], u32bit) const = 0;
virtual MemoryVector<byte> public_value() const = 0;
+
virtual ~PK_Key_Agreement_Key() {}
};