8 #include <botan/x509_ca.h>
9 #include <botan/pubkey.h>
10 #include <botan/der_enc.h>
11 #include <botan/ber_dec.h>
12 #include <botan/bigint.h>
13 #include <botan/parsing.h>
14 #include <botan/lookup.h>
15 #include <botan/oids.h>
16 #include <botan/key_constraint.h>
30 const std::string& hash_fn) : cert(c)
80 return make_cert(signer, rng, ca_sig_algo,
82 not_before, not_after,
93 const std::vector<byte>& pub_key,
100 const size_t X509_CERT_VERSION = 3;
101 const size_t SERIAL_BITS = 128;
103 BigInt serial_no(rng, SERIAL_BITS);
106 signer, rng, sig_algo,
109 .
encode(X509_CERT_VERSION-1)
142 std::vector<CRL_Entry> empty;
143 return make_crl(empty, 1, next_update, rng);
150 const std::vector<CRL_Entry>& new_revoked,
154 std::vector<CRL_Entry> revoked = crl.
get_revoked();
156 std::copy(new_revoked.begin(), new_revoked.end(),
157 std::back_inserter(revoked));
159 return make_crl(revoked, crl.
crl_number() + 1, next_update,
rng);
165 X509_CRL X509_CA::make_crl(
const std::vector<CRL_Entry>& revoked,
169 const size_t X509_CRL_VERSION = 2;
175 auto current_time = std::chrono::system_clock::now();
176 auto expire_time = current_time + std::chrono::seconds(next_update);
184 signer, rng, ca_sig_algo,
186 .
encode(X509_CRL_VERSION-1)
191 .encode_if(revoked.size() > 0,
220 const std::string& hash_fn,
234 if(algo_name ==
"RSA")
236 else if(algo_name ==
"DSA")
238 else if(algo_name ==
"ECDSA")
239 padding =
"EMSA1_BSI";
246 padding = padding +
'(' + proto_hash->
name() +
')';
251 return new PK_Signer(key, padding, format);