9#ifndef BOTAN_P11_ECDH_H_
10#define BOTAN_P11_ECDH_H_
14#if defined(BOTAN_HAS_ECDH)
16#include <botan/p11_ecc_key.h>
17#include <botan/ecdh.h>
27class BOTAN_PUBLIC_API(2,0) PKCS11_ECDH_PublicKey :
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;
58class BOTAN_PUBLIC_API(2,0) 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
98 return public_point().encode(PointGFp::UNCOMPRESSED);
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;
112using PKCS11_ECDH_KeyPair = std::pair<PKCS11_ECDH_PublicKey, PKCS11_ECDH_PrivateKey>;
120BOTAN_PUBLIC_API(2,0) PKCS11_ECDH_KeyPair generate_ecdh_keypair(Session& session, const EC_PublicKeyGenerationProperties& pub_props,
121 const EC_PrivateKeyGenerationProperties& priv_props);
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)