10#include <openssl/crypto.h>
42 const std::string& valid_from,
size_t validity_period_days)
58 const std::string& subject_name_,
60 const std::string& valid_from,
61 size_t validity_period_days) :
64 auto identity_key_pair =
65 std::make_shared<ccf::crypto::KeyPair_OpenSSL>(curve_id);
66 priv_key = identity_key_pair->private_key_pem();
68 cert = ccf::crypto::create_self_signed_cert(
73 validity_period_days);
81 throw std::runtime_error(
"invalid identity type conversion");
88 const std::string& valid_from,
size_t validity_period_days)
override
90 auto identity_key_pair =
91 std::make_shared<ccf::crypto::KeyPair_OpenSSL>(
priv_key);
93 return ccf::crypto::create_self_signed_cert(
98 validity_period_days);
ReplicatedNetworkIdentity(const std::string &subject_name_, ccf::crypto::CurveID curve_id, const std::string &valid_from, size_t validity_period_days)
Definition identity.h:57
virtual ccf::crypto::Pem issue_certificate(const std::string &valid_from, size_t validity_period_days) override
Definition identity.h:87
~ReplicatedNetworkIdentity() override
Definition identity.h:106
ReplicatedNetworkIdentity()=default
ReplicatedNetworkIdentity(const NetworkIdentity &other)
Definition identity.h:76
virtual void set_certificate(const ccf::crypto::Pem &new_cert) override
Definition identity.h:101
size_t size() const
Definition pem.h:61
uint8_t * data()
Definition pem.h:51
CurveID
Definition curve.h:18
Definition app_interface.h:15
IdentityType
Definition identity.h:17
virtual ccf::crypto::Pem issue_certificate(const std::string &valid_from, size_t validity_period_days)
Definition identity.h:41
NetworkIdentity()=default
NetworkIdentity(const std::string &subject_name_)
Definition identity.h:35
std::string subject_name
Definition identity.h:27
ccf::crypto::Pem cert
Definition identity.h:25
ccf::crypto::Pem priv_key
Definition identity.h:24
virtual void set_certificate(const ccf::crypto::Pem &certificate)
Definition identity.h:47
std::optional< IdentityType > type
Definition identity.h:26
bool operator==(const NetworkIdentity &other) const
Definition identity.h:29
virtual ~NetworkIdentity()
Definition identity.h:49