9#ifndef BOTAN_P11_ECDSA_H_
10#define BOTAN_P11_ECDSA_H_
13#include <botan/pk_keys.h>
15#if defined(BOTAN_HAS_ECDSA)
17#include <botan/p11_ecc_key.h>
18#include <botan/ecdsa.h>
27class BOTAN_PUBLIC_API(2,0) PKCS11_ECDSA_PublicKey
final :
public PKCS11_EC_PublicKey,
public virtual ECDSA_PublicKey
35 PKCS11_ECDSA_PublicKey(Session& session, ObjectHandle handle)
36 : EC_PublicKey(), PKCS11_EC_PublicKey(session, handle)
44 PKCS11_ECDSA_PublicKey(Session& session,
const EC_PublicKeyImportProperties& props)
45 : EC_PublicKey(), PKCS11_EC_PublicKey(session, props)
48 inline std::string algo_name()
const override
54 ECDSA_PublicKey export_key()
const;
56 std::unique_ptr<PK_Ops::Verification>
57 create_verification_op(
const std::string& params,
58 const std::string& provider)
const override;
70 PKCS11_ECDSA_PrivateKey(Session& session, ObjectHandle handle)
71 : PKCS11_EC_PrivateKey(session, handle)
79 PKCS11_ECDSA_PrivateKey(Session& session,
const EC_PrivateKeyImportProperties& props)
80 : PKCS11_EC_PrivateKey(session, props)
90 PKCS11_ECDSA_PrivateKey(Session& session,
const std::vector<uint8_t>& ec_params,
91 const EC_PrivateKeyGenerationProperties& props)
92 : PKCS11_EC_PrivateKey(session, ec_params, props)
95 inline std::string algo_name()
const override
100 size_t message_parts()
const override {
return 2; }
102 size_t message_part_size()
const override
103 {
return domain().get_order().bytes(); }
106 ECDSA_PrivateKey export_key()
const;
108 secure_vector<uint8_t> private_key_bits()
const override;
110 bool check_key(RandomNumberGenerator&,
bool)
const override;
112 std::unique_ptr<PK_Ops::Signature>
113 create_signature_op(RandomNumberGenerator& rng,
114 const std::string& params,
115 const std::string& provider)
const override;
118using PKCS11_ECDSA_KeyPair = std::pair<PKCS11_ECDSA_PublicKey, PKCS11_ECDSA_PrivateKey>;
126BOTAN_PUBLIC_API(2,0) PKCS11_ECDSA_KeyPair generate_ecdsa_keypair(Session& session,
127 const EC_PublicKeyGenerationProperties& pub_props, const EC_PrivateKeyGenerationProperties& priv_props);
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)