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/ecdsa.h>
18 #include <botan/p11_ecc_key.h>
31 public virtual ECDSA_PublicKey {
38 PKCS11_ECDSA_PublicKey(Session& session, ObjectHandle handle) :
39 EC_PublicKey(), PKCS11_EC_PublicKey(session, handle) {}
46 PKCS11_ECDSA_PublicKey(Session& session,
const EC_PublicKeyImportProperties& props) :
47 EC_PublicKey(), PKCS11_EC_PublicKey(session, props) {}
49 inline std::string algo_name()
const override {
return "ECDSA"; }
52 ECDSA_PublicKey export_key()
const;
57 std::unique_ptr<Private_Key> generate_another(RandomNumberGenerator&)
const final {
58 throw Not_Implemented(
"Cannot generate a new PKCS#11 ECDSA keypair from this public key");
61 std::unique_ptr<PK_Ops::Verification> create_verification_op(std::string_view params,
62 std::string_view provider)
const override;
75 PKCS11_ECDSA_PrivateKey(Session& session, ObjectHandle handle) : PKCS11_EC_PrivateKey(session, handle) {}
82 PKCS11_ECDSA_PrivateKey(Session& session,
const EC_PrivateKeyImportProperties& props) :
83 PKCS11_EC_PrivateKey(session, props) {}
92 PKCS11_ECDSA_PrivateKey(Session& session,
93 const std::vector<uint8_t>& ec_params,
94 const EC_PrivateKeyGenerationProperties& props) :
95 PKCS11_EC_PrivateKey(session, ec_params, props) {}
97 inline std::string algo_name()
const override {
return "ECDSA"; }
102 std::unique_ptr<Private_Key> generate_another(RandomNumberGenerator&)
const override {
103 throw Not_Implemented(
"Cannot generate a new PKCS#11 ECDSA keypair from this private key");
106 bool supports_operation(PublicKeyOperation op)
const override {
return (op == PublicKeyOperation::Signature); }
108 size_t message_parts()
const override {
return 2; }
110 size_t message_part_size()
const override {
return domain().get_order_bytes(); }
113 ECDSA_PrivateKey export_key()
const;
115 std::unique_ptr<Public_Key> public_key()
const override;
117 secure_vector<uint8_t> private_key_bits()
const override;
119 bool check_key(RandomNumberGenerator&,
bool)
const override;
121 std::unique_ptr<PK_Ops::Signature> create_signature_op(RandomNumberGenerator& rng,
122 std::string_view params,
123 std::string_view provider)
const override;
126using PKCS11_ECDSA_KeyPair = std::pair<PKCS11_ECDSA_PublicKey, PKCS11_ECDSA_PrivateKey>;
135PKCS11_ECDSA_KeyPair generate_ecdsa_keypair(Session& session,
136 const EC_PublicKeyGenerationProperties& pub_props,
137 const EC_PrivateKeyGenerationProperties& priv_props);
int(* final)(unsigned char *, CTX *)
#define BOTAN_DIAGNOSTIC_POP
#define BOTAN_DIAGNOSTIC_PUSH
#define BOTAN_DIAGNOSTIC_IGNORE_INHERITED_VIA_DOMINANCE
#define BOTAN_PUBLIC_API(maj, min)