9 #ifndef BOTAN_P11_ECDH_H__
10 #define BOTAN_P11_ECDH_H__
12 #include <botan/build.h>
13 #if defined(BOTAN_HAS_ECDH)
15 #include <botan/p11.h>
16 #include <botan/p11_ecc_key.h>
17 #include <botan/ecdh.h>
27 class BOTAN_DLL PKCS11_ECDH_PublicKey final :
public PKCS11_EC_PublicKey
35 PKCS11_ECDH_PublicKey(Session& session,
ObjectHandle handle)
36 : EC_PublicKey(), PKCS11_EC_PublicKey(session, handle)
44 PKCS11_ECDH_PublicKey(Session& session,
const EC_PublicKeyImportProperties& props)
45 : EC_PublicKey(), PKCS11_EC_PublicKey(session, props)
48 inline std::string algo_name()
const override
54 ECDH_PublicKey export_key()
const;
58 class BOTAN_DLL PKCS11_ECDH_PrivateKey final :
public virtual PKCS11_EC_PrivateKey,
public virtual PK_Key_Agreement_Key
66 PKCS11_ECDH_PrivateKey(Session& session,
ObjectHandle handle)
67 : PKCS11_EC_PrivateKey(session, handle)
75 PKCS11_ECDH_PrivateKey(Session& session,
const EC_PrivateKeyImportProperties& props)
76 : PKCS11_EC_PrivateKey(session, props)
86 PKCS11_ECDH_PrivateKey(Session& session,
const std::vector<uint8_t>& ec_params,
87 const EC_PrivateKeyGenerationProperties& props)
88 : PKCS11_EC_PrivateKey(session, ec_params, props)
91 inline std::string algo_name()
const override
96 inline std::vector<uint8_t> public_value()
const override
102 ECDH_PrivateKey export_key()
const;
104 secure_vector<uint8_t> private_key_bits()
const override;
106 std::unique_ptr<PK_Ops::Key_Agreement>
107 create_key_agreement_op(RandomNumberGenerator& rng,
108 const std::string& params,
109 const std::string& provider)
const override;
112 using PKCS11_ECDH_KeyPair = std::pair<PKCS11_ECDH_PublicKey, PKCS11_ECDH_PrivateKey>;
120 BOTAN_DLL PKCS11_ECDH_KeyPair generate_ecdh_keypair(Session& session,
const EC_PublicKeyGenerationProperties& pub_props,
121 const EC_PrivateKeyGenerationProperties& priv_props);
secure_vector< uint8_t > EC2OSP(const PointGFp &point, uint8_t format)
CK_OBJECT_HANDLE ObjectHandle
std::vector< T > unlock(const secure_vector< T > &in)