9#ifndef BOTAN_P11_ECC_H_
10#define BOTAN_P11_ECC_H_
12#include <botan/p11_object.h>
13#include <botan/pk_keys.h>
15#if defined(BOTAN_HAS_ECC_PUBLIC_KEY_CRYPTO)
16 #include <botan/asn1_obj.h>
17 #include <botan/ec_group.h>
18 #include <botan/ecc_key.h>
29 EC_PublicKeyGenerationProperties(
const std::vector<uint8_t>& ec_params);
32 inline const std::vector<uint8_t>& ec_params()
const {
return m_ec_params; }
35 const std::vector<uint8_t> m_ec_params;
45 EC_PublicKeyImportProperties(
const std::vector<uint8_t>& ec_params,
const std::vector<uint8_t>& ec_point);
48 inline const std::vector<uint8_t>& ec_params()
const {
return m_ec_params; }
51 inline const std::vector<uint8_t>& ec_point()
const {
return m_ec_point; }
54 const std::vector<uint8_t> m_ec_params;
55 const std::vector<uint8_t> m_ec_point;
59class BOTAN_PUBLIC_API(2, 0) PKCS11_EC_PublicKey :
public virtual EC_PublicKey,
69 PKCS11_EC_PublicKey(Session& session, ObjectHandle handle);
76 PKCS11_EC_PublicKey(Session& session,
const EC_PublicKeyImportProperties& props);
82 EC_PrivateKeyGenerationProperties() : PrivateKeyProperties(
KeyType::
Ec) {}
92 EC_PrivateKeyImportProperties(
const std::vector<uint8_t>& ec_params,
const BigInt& value);
95 inline const std::vector<uint8_t>& ec_params()
const {
return m_ec_params; }
98 inline const BigInt& value()
const {
return m_value; }
101 const std::vector<uint8_t> m_ec_params;
102 const BigInt m_value;
108class BOTAN_PUBLIC_API(2, 0) PKCS11_EC_PrivateKey :
public virtual Private_Key,
118 PKCS11_EC_PrivateKey(Session& session, ObjectHandle handle);
125 PKCS11_EC_PrivateKey(Session& session,
const EC_PrivateKeyImportProperties& props);
134 PKCS11_EC_PrivateKey(Session& session,
135 const std::vector<uint8_t>& ec_params,
136 const EC_PrivateKeyGenerationProperties& props);
139 inline const EC_Group& domain()
const {
return m_domain_params; }
146 void set_public_point(
const EC_Point& point, PublicPointEncoding point_encoding = PublicPointEncoding::Der) {
147 m_public_key = point;
148 m_point_encoding = point_encoding;
156 void set_point_encoding(PublicPointEncoding point_encoding) { m_point_encoding = point_encoding; }
165 const EC_Point& public_point()
const {
166 if(m_public_key.is_zero()) {
168 "Public point not set. Inferring the public key from a PKCS#11 ec private key is not possible.");
178 std::vector<uint8_t> raw_public_key_bits()
const override;
180 std::vector<uint8_t> public_key_bits()
const override;
182 std::size_t key_length()
const override;
184 std::size_t estimated_strength()
const override;
186 bool check_key(RandomNumberGenerator&,
bool)
const override;
188 AlgorithmIdentifier algorithm_identifier()
const override;
191 EC_Group m_domain_params;
192 EC_Point m_public_key;
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)