aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/x509
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-12-18 16:53:10 -0500
committerJack Lloyd <[email protected]>2016-12-18 16:53:25 -0500
commit5eca80aa3336dc49c721e9c6404f531f2e290537 (patch)
tree645c73ec295a5a34f25d99903b6d9fa9751e86d3 /src/lib/x509
parentc1dd21253c1f3188ff45d3ad47698efd08235ae8 (diff)
parentf3cb3edb512bdcab498d825886c3366c341b3f78 (diff)
Merge GH #771 Use cstdint integer types
Diffstat (limited to 'src/lib/x509')
-rw-r--r--src/lib/x509/certstor.cpp12
-rw-r--r--src/lib/x509/certstor.h8
-rw-r--r--src/lib/x509/certstor_sql/certstor_sql.cpp12
-rw-r--r--src/lib/x509/certstor_sql/certstor_sql.h4
-rw-r--r--src/lib/x509/crl_ent.cpp2
-rw-r--r--src/lib/x509/crl_ent.h4
-rw-r--r--src/lib/x509/name_constraint.cpp12
-rw-r--r--src/lib/x509/ocsp.cpp4
-rw-r--r--src/lib/x509/ocsp.h18
-rw-r--r--src/lib/x509/ocsp_types.h6
-rw-r--r--src/lib/x509/pkcs10.cpp4
-rw-r--r--src/lib/x509/pkcs10.h4
-rw-r--r--src/lib/x509/x509_ca.cpp10
-rw-r--r--src/lib/x509/x509_ca.h8
-rw-r--r--src/lib/x509/x509_crl.cpp14
-rw-r--r--src/lib/x509/x509_crl.h6
-rw-r--r--src/lib/x509/x509_ext.cpp66
-rw-r--r--src/lib/x509/x509_ext.h72
-rw-r--r--src/lib/x509/x509_obj.cpp12
-rw-r--r--src/lib/x509/x509_obj.h14
-rw-r--r--src/lib/x509/x509cert.cpp42
-rw-r--r--src/lib/x509/x509cert.h22
-rw-r--r--src/lib/x509/x509opt.cpp2
-rw-r--r--src/lib/x509/x509path.cpp2
-rw-r--r--src/lib/x509/x509self.cpp6
-rw-r--r--src/lib/x509/x509self.h2
26 files changed, 184 insertions, 184 deletions
diff --git a/src/lib/x509/certstor.cpp b/src/lib/x509/certstor.cpp
index 1f7275675..10178a526 100644
--- a/src/lib/x509/certstor.cpp
+++ b/src/lib/x509/certstor.cpp
@@ -48,14 +48,14 @@ std::vector<X509_DN> Certificate_Store_In_Memory::all_subjects() const
std::shared_ptr<const X509_Certificate>
Certificate_Store_In_Memory::find_cert(const X509_DN& subject_dn,
- const std::vector<byte>& key_id) const
+ const std::vector<uint8_t>& key_id) const
{
for(size_t i = 0; i != m_certs.size(); ++i)
{
// Only compare key ids if set in both call and in the cert
if(key_id.size())
{
- std::vector<byte> skid = m_certs[i]->subject_key_id();
+ std::vector<uint8_t> skid = m_certs[i]->subject_key_id();
if(skid.size() && skid != key_id) // no match
continue;
@@ -70,14 +70,14 @@ Certificate_Store_In_Memory::find_cert(const X509_DN& subject_dn,
std::shared_ptr<const X509_Certificate>
-Certificate_Store_In_Memory::find_cert_by_pubkey_sha1(const std::vector<byte>& key_hash) const
+Certificate_Store_In_Memory::find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const
{
if(key_hash.size() != 20)
throw Invalid_Argument("Certificate_Store_In_Memory::find_cert_by_pubkey_sha1 invalid hash");
for(size_t i = 0; i != m_certs.size(); ++i)
{
- const std::vector<byte> hash_i = m_certs[i]->subject_public_key_bitstring_sha1();
+ const std::vector<uint8_t> hash_i = m_certs[i]->subject_public_key_bitstring_sha1();
if(key_hash == hash_i)
{
return m_certs[i];
@@ -114,14 +114,14 @@ void Certificate_Store_In_Memory::add_crl(std::shared_ptr<const X509_CRL> crl)
std::shared_ptr<const X509_CRL> Certificate_Store_In_Memory::find_crl_for(const X509_Certificate& subject) const
{
- const std::vector<byte>& key_id = subject.authority_key_id();
+ const std::vector<uint8_t>& key_id = subject.authority_key_id();
for(size_t i = 0; i != m_crls.size(); ++i)
{
// Only compare key ids if set in both call and in the CRL
if(key_id.size())
{
- std::vector<byte> akid = m_crls[i]->authority_key_id();
+ std::vector<uint8_t> akid = m_crls[i]->authority_key_id();
if(akid.size() && akid != key_id) // no match
continue;
diff --git a/src/lib/x509/certstor.h b/src/lib/x509/certstor.h
index ba71334c5..3ac357767 100644
--- a/src/lib/x509/certstor.h
+++ b/src/lib/x509/certstor.h
@@ -28,7 +28,7 @@ class BOTAN_DLL Certificate_Store
* @return a matching certificate or nullptr otherwise
*/
virtual std::shared_ptr<const X509_Certificate>
- find_cert(const X509_DN& subject_dn, const std::vector<byte>& key_id) const = 0;
+ find_cert(const X509_DN& subject_dn, const std::vector<uint8_t>& key_id) const = 0;
/**
* Find a certificate by searching for one with a matching SHA-1 hash of
@@ -37,7 +37,7 @@ class BOTAN_DLL Certificate_Store
* @return a matching certificate or nullptr otherwise
*/
virtual std::shared_ptr<const X509_Certificate>
- find_cert_by_pubkey_sha1(const std::vector<byte>& key_hash) const = 0;
+ find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const = 0;
/**
* Finds a CRL for the given certificate
@@ -115,10 +115,10 @@ class BOTAN_DLL Certificate_Store_In_Memory : public Certificate_Store
*/
std::shared_ptr<const X509_Certificate> find_cert(
const X509_DN& subject_dn,
- const std::vector<byte>& key_id) const override;
+ const std::vector<uint8_t>& key_id) const override;
std::shared_ptr<const X509_Certificate>
- find_cert_by_pubkey_sha1(const std::vector<byte>& key_hash) const override;
+ find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const override;
/**
* Finds a CRL for the given certificate
diff --git a/src/lib/x509/certstor_sql/certstor_sql.cpp b/src/lib/x509/certstor_sql/certstor_sql.cpp
index 4dceae305..06e0fda1b 100644
--- a/src/lib/x509/certstor_sql/certstor_sql.cpp
+++ b/src/lib/x509/certstor_sql/certstor_sql.cpp
@@ -46,7 +46,7 @@ Certificate_Store_In_SQL::Certificate_Store_In_SQL(std::shared_ptr<SQL_Database>
// Certificate handling
std::shared_ptr<const X509_Certificate>
-Certificate_Store_In_SQL::find_cert(const X509_DN& subject_dn, const std::vector<byte>& key_id) const
+Certificate_Store_In_SQL::find_cert(const X509_DN& subject_dn, const std::vector<uint8_t>& key_id) const
{
DER_Encoder enc;
std::shared_ptr<SQL_Database::Statement> stmt;
@@ -71,7 +71,7 @@ Certificate_Store_In_SQL::find_cert(const X509_DN& subject_dn, const std::vector
{
auto blob = stmt->get_blob(0);
cert = std::make_shared<X509_Certificate>(
- std::vector<byte>(blob.first,blob.first + blob.second));
+ std::vector<uint8_t>(blob.first,blob.first + blob.second));
}
@@ -79,7 +79,7 @@ Certificate_Store_In_SQL::find_cert(const X509_DN& subject_dn, const std::vector
}
std::shared_ptr<const X509_Certificate>
-Certificate_Store_In_SQL::find_cert_by_pubkey_sha1(const std::vector<byte>& /*key_hash*/) const
+Certificate_Store_In_SQL::find_cert_by_pubkey_sha1(const std::vector<uint8_t>& /*key_hash*/) const
{
// TODO!
return nullptr;
@@ -137,7 +137,7 @@ bool Certificate_Store_In_SQL::insert_cert(const X509_Certificate& cert)
cert.subject_dn().encode_into(enc);
stmt->bind(2,enc.get_contents_unlocked());
stmt->bind(3,cert.subject_key_id());
- stmt->bind(4,std::vector<byte>());
+ stmt->bind(4,std::vector<uint8_t>());
enc = DER_Encoder();
cert.encode_into(enc);
stmt->bind(5,enc.get_contents_unlocked());
@@ -193,7 +193,7 @@ Certificate_Store_In_SQL::find_certs_for_key(const Private_Key& key) const
{
auto blob = stmt->get_blob(0);
certs.push_back(std::make_shared<X509_Certificate>(
- std::vector<byte>(blob.first,blob.first + blob.second)));
+ std::vector<uint8_t>(blob.first,blob.first + blob.second)));
}
return certs;
@@ -279,7 +279,7 @@ std::vector<X509_CRL> Certificate_Store_In_SQL::generate_crls() const
{
auto blob = stmt->get_blob(0);
auto cert = X509_Certificate(
- std::vector<byte>(blob.first,blob.first + blob.second));
+ std::vector<uint8_t>(blob.first,blob.first + blob.second));
auto code = static_cast<CRL_Code>(stmt->get_size_t(1));
auto ent = CRL_Entry(cert,code);
diff --git a/src/lib/x509/certstor_sql/certstor_sql.h b/src/lib/x509/certstor_sql/certstor_sql.h
index 0f493c56b..91d8d5c00 100644
--- a/src/lib/x509/certstor_sql/certstor_sql.h
+++ b/src/lib/x509/certstor_sql/certstor_sql.h
@@ -39,10 +39,10 @@ class BOTAN_DLL Certificate_Store_In_SQL : public Certificate_Store
* Returns the first certificate with matching subject DN and optional key ID.
*/
virtual std::shared_ptr<const X509_Certificate>
- find_cert(const X509_DN& subject_dn, const std::vector<byte>& key_id) const override;
+ find_cert(const X509_DN& subject_dn, const std::vector<uint8_t>& key_id) const override;
std::shared_ptr<const X509_Certificate>
- find_cert_by_pubkey_sha1(const std::vector<byte>& key_hash) const override;
+ find_cert_by_pubkey_sha1(const std::vector<uint8_t>& key_hash) const override;
/**
* Returns all subject DNs known to the store instance.
diff --git a/src/lib/x509/crl_ent.cpp b/src/lib/x509/crl_ent.cpp
index 7074f0609..f717e7b07 100644
--- a/src/lib/x509/crl_ent.cpp
+++ b/src/lib/x509/crl_ent.cpp
@@ -93,7 +93,7 @@ void CRL_Entry::decode_from(BER_Decoder& source)
entry.decode(extensions);
Data_Store info;
extensions.contents_to(info, info);
- m_reason = CRL_Code(info.get1_u32bit("X509v3.CRLReasonCode"));
+ m_reason = CRL_Code(info.get1_uint32("X509v3.CRLReasonCode"));
}
entry.end_cons();
diff --git a/src/lib/x509/crl_ent.h b/src/lib/x509/crl_ent.h
index 6600621e5..233781826 100644
--- a/src/lib/x509/crl_ent.h
+++ b/src/lib/x509/crl_ent.h
@@ -47,7 +47,7 @@ class BOTAN_DLL CRL_Entry final : public ASN1_Object
* Get the serial number of the certificate associated with this entry.
* @return certificate's serial number
*/
- std::vector<byte> serial_number() const { return m_serial; }
+ std::vector<uint8_t> serial_number() const { return m_serial; }
/**
* Get the revocation date of the certificate associated with this entry
@@ -78,7 +78,7 @@ class BOTAN_DLL CRL_Entry final : public ASN1_Object
private:
bool m_throw_on_unknown_critical;
- std::vector<byte> m_serial;
+ std::vector<uint8_t> m_serial;
X509_Time m_time;
CRL_Code m_reason;
};
diff --git a/src/lib/x509/name_constraint.cpp b/src/lib/x509/name_constraint.cpp
index e4d69c6ac..703c6770c 100644
--- a/src/lib/x509/name_constraint.cpp
+++ b/src/lib/x509/name_constraint.cpp
@@ -79,10 +79,10 @@ void GeneralName::decode_from(class BER_Decoder& ber)
{
if(obj.value.size() == 8)
{
- const std::vector<byte> ip(obj.value.begin(), obj.value.begin() + 4);
- const std::vector<byte> net(obj.value.begin() + 4, obj.value.end());
+ const std::vector<uint8_t> ip(obj.value.begin(), obj.value.begin() + 4);
+ const std::vector<uint8_t> net(obj.value.begin() + 4, obj.value.end());
m_type = "IP";
- m_name = ipv4_to_string(load_be<u32bit>(ip.data(), 0)) + "/" + ipv4_to_string(load_be<u32bit>(net.data(), 0));
+ m_name = ipv4_to_string(load_be<uint32_t>(ip.data(), 0)) + "/" + ipv4_to_string(load_be<uint32_t>(net.data(), 0));
}
else if(obj.value.size() == 32)
{
@@ -210,14 +210,14 @@ bool GeneralName::matches_dn(const std::string& nam) const
bool GeneralName::matches_ip(const std::string& nam) const
{
- u32bit ip = string_to_ipv4(nam);
+ uint32_t ip = string_to_ipv4(nam);
std::vector<std::string> p = split_on(name(), '/');
if(p.size() != 2)
throw Decoding_Error("failed to parse IPv4 address");
- u32bit net = string_to_ipv4(p.at(0));
- u32bit mask = string_to_ipv4(p.at(1));
+ uint32_t net = string_to_ipv4(p.at(0));
+ uint32_t mask = string_to_ipv4(p.at(1));
return (ip & mask) == net;
}
diff --git a/src/lib/x509/ocsp.cpp b/src/lib/x509/ocsp.cpp
index bd3f1855e..964299f64 100644
--- a/src/lib/x509/ocsp.cpp
+++ b/src/lib/x509/ocsp.cpp
@@ -60,7 +60,7 @@ Request::Request(const X509_Certificate& issuer_cert,
throw Invalid_Argument("Invalid cert pair to OCSP::Request (mismatched issuer,subject args?)");
}
-std::vector<byte> Request::BER_encode() const
+std::vector<uint8_t> Request::BER_encode() const
{
return DER_Encoder().start_cons(SEQUENCE)
.start_cons(SEQUENCE)
@@ -175,7 +175,7 @@ Certificate_Status_Code Response::check_signature(const std::vector<Certificate_
if(!m_signer_name.empty())
{
- signing_cert = trusted_roots[i]->find_cert(m_signer_name, std::vector<byte>());
+ signing_cert = trusted_roots[i]->find_cert(m_signer_name, std::vector<uint8_t>());
if(signing_cert)
{
break;
diff --git a/src/lib/x509/ocsp.h b/src/lib/x509/ocsp.h
index 05f194392..ff6a19567 100644
--- a/src/lib/x509/ocsp.h
+++ b/src/lib/x509/ocsp.h
@@ -34,7 +34,7 @@ class BOTAN_DLL Request
/**
* @return BER-encoded OCSP request
*/
- std::vector<byte> BER_encode() const;
+ std::vector<uint8_t> BER_encode() const;
/**
* @return Base64-encoded OCSP request
@@ -51,7 +51,7 @@ class BOTAN_DLL Request
*/
const X509_Certificate& subject() const { return m_subject; }
- const std::vector<byte>& issuer_key_hash() const
+ const std::vector<uint8_t>& issuer_key_hash() const
{ return m_certid.issuer_key_hash(); }
private:
X509_Certificate m_issuer, m_subject;
@@ -75,7 +75,7 @@ class BOTAN_DLL Response
* Parses an OCSP response.
* @param response_bits response bits received
*/
- Response(const std::vector<byte>& response_bits) :
+ Response(const std::vector<uint8_t>& response_bits) :
Response(response_bits.data(), response_bits.size())
{}
@@ -119,9 +119,9 @@ class BOTAN_DLL Response
/**
* @return key hash, if provided in response (may be empty)
*/
- const std::vector<byte>& signer_key_hash() const { return m_key_hash; }
+ const std::vector<uint8_t>& signer_key_hash() const { return m_key_hash; }
- const std::vector<byte>& raw_bits() const { return m_response_bits; }
+ const std::vector<uint8_t>& raw_bits() const { return m_response_bits; }
/**
* Searches the OCSP response for issuer and subject certificate.
@@ -141,13 +141,13 @@ class BOTAN_DLL Response
std::chrono::system_clock::time_point ref_time = std::chrono::system_clock::now()) const;
private:
- std::vector<byte> m_response_bits;
+ std::vector<uint8_t> m_response_bits;
X509_Time m_produced_at;
X509_DN m_signer_name;
- std::vector<byte> m_key_hash;
- std::vector<byte> m_tbs_bits;
+ std::vector<uint8_t> m_key_hash;
+ std::vector<uint8_t> m_tbs_bits;
AlgorithmIdentifier m_sig_algo;
- std::vector<byte> m_signature;
+ std::vector<uint8_t> m_signature;
std::vector<X509_Certificate> m_certs;
std::vector<SingleResponse> m_responses;
diff --git a/src/lib/x509/ocsp_types.h b/src/lib/x509/ocsp_types.h
index 40fbb85a8..1cbf207b8 100644
--- a/src/lib/x509/ocsp_types.h
+++ b/src/lib/x509/ocsp_types.h
@@ -31,12 +31,12 @@ class BOTAN_DLL CertID final : public ASN1_Object
void decode_from(class BER_Decoder& from) override;
- const std::vector<byte>& issuer_key_hash() const { return m_issuer_key_hash; }
+ const std::vector<uint8_t>& issuer_key_hash() const { return m_issuer_key_hash; }
private:
AlgorithmIdentifier m_hash_id;
- std::vector<byte> m_issuer_dn_hash;
- std::vector<byte> m_issuer_key_hash;
+ std::vector<uint8_t> m_issuer_dn_hash;
+ std::vector<uint8_t> m_issuer_key_hash;
BigInt m_subject_serial;
};
diff --git a/src/lib/x509/pkcs10.cpp b/src/lib/x509/pkcs10.cpp
index 22508f131..a9cec86ee 100644
--- a/src/lib/x509/pkcs10.cpp
+++ b/src/lib/x509/pkcs10.cpp
@@ -39,7 +39,7 @@ PKCS10_Request::PKCS10_Request(const std::string& fsname) :
/*
* PKCS10_Request Constructor
*/
-PKCS10_Request::PKCS10_Request(const std::vector<byte>& in) :
+PKCS10_Request::PKCS10_Request(const std::vector<uint8_t>& in) :
X509_Object(in, "CERTIFICATE REQUEST/NEW CERTIFICATE REQUEST")
{
do_decode();
@@ -143,7 +143,7 @@ X509_DN PKCS10_Request::subject_dn() const
/*
* Return the public key of the requestor
*/
-std::vector<byte> PKCS10_Request::raw_public_key() const
+std::vector<uint8_t> PKCS10_Request::raw_public_key() const
{
DataSource_Memory source(m_info.get1("X509.Certificate.public_key"));
return unlock(PEM_Code::decode_check_label(source, "PUBLIC KEY"));
diff --git a/src/lib/x509/pkcs10.h b/src/lib/x509/pkcs10.h
index 2202b92a4..3e0c37950 100644
--- a/src/lib/x509/pkcs10.h
+++ b/src/lib/x509/pkcs10.h
@@ -36,7 +36,7 @@ class BOTAN_DLL PKCS10_Request final : public X509_Object
* Get the raw DER encoded public key.
* @return raw DER encoded public key
*/
- std::vector<byte> raw_public_key() const;
+ std::vector<uint8_t> raw_public_key() const;
/**
* Get the subject DN.
@@ -107,7 +107,7 @@ class BOTAN_DLL PKCS10_Request final : public X509_Object
* Create a PKCS#10 Request from binary data.
* @param vec a std::vector containing the DER value
*/
- explicit PKCS10_Request(const std::vector<byte>& vec);
+ explicit PKCS10_Request(const std::vector<uint8_t>& vec);
private:
void force_decode() override;
void handle_attribute(const Attribute&);
diff --git a/src/lib/x509/x509_ca.cpp b/src/lib/x509/x509_ca.cpp
index ec56abc92..692f837ae 100644
--- a/src/lib/x509/x509_ca.cpp
+++ b/src/lib/x509/x509_ca.cpp
@@ -96,7 +96,7 @@ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req,
X509_Certificate X509_CA::make_cert(PK_Signer* signer,
RandomNumberGenerator& rng,
const AlgorithmIdentifier& sig_algo,
- const std::vector<byte>& pub_key,
+ const std::vector<uint8_t>& pub_key,
const X509_Time& not_before,
const X509_Time& not_after,
const X509_DN& issuer_dn,
@@ -144,7 +144,7 @@ X509_Certificate X509_CA::make_cert(PK_Signer* signer,
* Create a new, empty CRL
*/
X509_CRL X509_CA::new_crl(RandomNumberGenerator& rng,
- u32bit next_update) const
+ uint32_t next_update) const
{
std::vector<CRL_Entry> empty;
return make_crl(empty, 1, next_update, rng);
@@ -156,7 +156,7 @@ X509_CRL X509_CA::new_crl(RandomNumberGenerator& rng,
X509_CRL X509_CA::update_crl(const X509_CRL& crl,
const std::vector<CRL_Entry>& new_revoked,
RandomNumberGenerator& rng,
- u32bit next_update) const
+ uint32_t next_update) const
{
std::vector<CRL_Entry> revoked = crl.get_revoked();
@@ -170,7 +170,7 @@ X509_CRL X509_CA::update_crl(const X509_CRL& crl,
* Create a CRL
*/
X509_CRL X509_CA::make_crl(const std::vector<CRL_Entry>& revoked,
- u32bit crl_number, u32bit next_update,
+ uint32_t crl_number, uint32_t next_update,
RandomNumberGenerator& rng) const
{
const size_t X509_CRL_VERSION = 2;
@@ -188,7 +188,7 @@ X509_CRL X509_CA::make_crl(const std::vector<CRL_Entry>& revoked,
extensions.add(new Cert_Extension::CRL_Number(crl_number));
// clang-format off
- const std::vector<byte> crl = X509_Object::make_signed(
+ const std::vector<uint8_t> crl = X509_Object::make_signed(
m_signer, rng, m_ca_sig_algo,
DER_Encoder().start_cons(SEQUENCE)
.encode(X509_CRL_VERSION-1)
diff --git a/src/lib/x509/x509_ca.h b/src/lib/x509/x509_ca.h
index 5b5eb6fc8..0448e109b 100644
--- a/src/lib/x509/x509_ca.h
+++ b/src/lib/x509/x509_ca.h
@@ -54,7 +54,7 @@ class BOTAN_DLL X509_CA
* @return new CRL
*/
X509_CRL new_crl(RandomNumberGenerator& rng,
- u32bit next_update = 0) const;
+ uint32_t next_update = 0) const;
/**
* Create a new CRL by with additional entries.
@@ -67,7 +67,7 @@ class BOTAN_DLL X509_CA
X509_CRL update_crl(const X509_CRL& last_crl,
const std::vector<CRL_Entry>& new_entries,
RandomNumberGenerator& rng,
- u32bit next_update = 0) const;
+ uint32_t next_update = 0) const;
/**
* Interface for creating new certificates
@@ -85,7 +85,7 @@ class BOTAN_DLL X509_CA
static X509_Certificate make_cert(PK_Signer* signer,
RandomNumberGenerator& rng,
const AlgorithmIdentifier& sig_algo,
- const std::vector<byte>& pub_key,
+ const std::vector<uint8_t>& pub_key,
const X509_Time& not_before,
const X509_Time& not_after,
const X509_DN& issuer_dn,
@@ -119,7 +119,7 @@ class BOTAN_DLL X509_CA
~X509_CA();
private:
X509_CRL make_crl(const std::vector<CRL_Entry>& entries,
- u32bit crl_number, u32bit next_update,
+ uint32_t crl_number, uint32_t next_update,
RandomNumberGenerator& rng) const;
AlgorithmIdentifier m_ca_sig_algo;
diff --git a/src/lib/x509/x509_crl.cpp b/src/lib/x509/x509_crl.cpp
index 8eb4c01db..65d426f20 100644
--- a/src/lib/x509/x509_crl.cpp
+++ b/src/lib/x509/x509_crl.cpp
@@ -35,7 +35,7 @@ X509_CRL::X509_CRL(const std::string& fsname, bool touc) :
}
#endif
-X509_CRL::X509_CRL(const std::vector<byte>& in, bool touc) :
+X509_CRL::X509_CRL(const std::vector<uint8_t>& in, bool touc) :
X509_Object(in, "CRL/X509 CRL"), m_throw_on_unknown_critical(touc)
{
do_decode();
@@ -62,14 +62,14 @@ bool X509_CRL::is_revoked(const X509_Certificate& cert) const
if(cert.issuer_dn() != issuer_dn())
return false;
- std::vector<byte> crl_akid = authority_key_id();
- std::vector<byte> cert_akid = cert.authority_key_id();
+ std::vector<uint8_t> crl_akid = authority_key_id();
+ std::vector<uint8_t> cert_akid = cert.authority_key_id();
if(!crl_akid.empty() && !cert_akid.empty())
if(crl_akid != cert_akid)
return false;
- std::vector<byte> cert_serial = cert.serial_number();
+ std::vector<uint8_t> cert_serial = cert.serial_number();
bool is_revoked = false;
@@ -170,7 +170,7 @@ X509_DN X509_CRL::issuer_dn() const
/*
* Return the key identifier of the issuer
*/
-std::vector<byte> X509_CRL::authority_key_id() const
+std::vector<uint8_t> X509_CRL::authority_key_id() const
{
return m_info.get1_memvec("X509v3.AuthorityKeyIdentifier");
}
@@ -178,9 +178,9 @@ std::vector<byte> X509_CRL::authority_key_id() const
/*
* Return the CRL number of this CRL
*/
-u32bit X509_CRL::crl_number() const
+uint32_t X509_CRL::crl_number() const
{
- return m_info.get1_u32bit("X509v3.CRLNumber");
+ return m_info.get1_uint32("X509v3.CRLNumber");
}
/*
diff --git a/src/lib/x509/x509_crl.h b/src/lib/x509/x509_crl.h
index e11ea8f48..ec0feb3d0 100644
--- a/src/lib/x509/x509_crl.h
+++ b/src/lib/x509/x509_crl.h
@@ -54,13 +54,13 @@ class BOTAN_DLL X509_CRL final : public X509_Object
* Get the AuthorityKeyIdentifier of this CRL.
* @return this CRLs AuthorityKeyIdentifier
*/
- std::vector<byte> authority_key_id() const;
+ std::vector<uint8_t> authority_key_id() const;
/**
* Get the serial number of this CRL.
* @return CRLs serial number
*/
- u32bit crl_number() const;
+ uint32_t crl_number() const;
/**
* Get the CRL's thisUpdate value.
@@ -99,7 +99,7 @@ class BOTAN_DLL X509_CRL final : public X509_Object
* @param throw_on_unknown_critical should we throw an exception
* if an unknown CRL extension marked as critical is encountered.
*/
- X509_CRL(const std::vector<byte>& vec,
+ X509_CRL(const std::vector<uint8_t>& vec,
bool throw_on_unknown_critical = false);
/**
diff --git a/src/lib/x509/x509_ext.cpp b/src/lib/x509/x509_ext.cpp
index 9ef14e88d..199ca6bcc 100644
--- a/src/lib/x509/x509_ext.cpp
+++ b/src/lib/x509/x509_ext.cpp
@@ -146,7 +146,7 @@ std::vector<std::pair<std::unique_ptr<Certificate_Extension>, bool>> Extensions:
return exts;
}
-std::map<OID, std::pair<std::vector<byte>, bool>> Extensions::extensions_raw() const
+std::map<OID, std::pair<std::vector<uint8_t>, bool>> Extensions::extensions_raw() const
{
return m_extensions_raw;
}
@@ -212,7 +212,7 @@ void Extensions::decode_from(BER_Decoder& from_source)
while(sequence.more_items())
{
OID oid;
- std::vector<byte> value;
+ std::vector<uint8_t> value;
bool critical;
sequence.start_cons(SEQUENCE)
@@ -278,7 +278,7 @@ size_t Basic_Constraints::get_path_limit() const
/*
* Encode the extension
*/
-std::vector<byte> Basic_Constraints::encode_inner() const
+std::vector<uint8_t> Basic_Constraints::encode_inner() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
@@ -294,7 +294,7 @@ std::vector<byte> Basic_Constraints::encode_inner() const
/*
* Decode the extension
*/
-void Basic_Constraints::decode_inner(const std::vector<byte>& in)
+void Basic_Constraints::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in)
.start_cons(SEQUENCE)
@@ -313,20 +313,20 @@ void Basic_Constraints::decode_inner(const std::vector<byte>& in)
void Basic_Constraints::contents_to(Data_Store& subject, Data_Store&) const
{
subject.add("X509v3.BasicConstraints.is_ca", (m_is_ca ? 1 : 0));
- subject.add("X509v3.BasicConstraints.path_constraint", static_cast<u32bit>(m_path_limit));
+ subject.add("X509v3.BasicConstraints.path_constraint", static_cast<uint32_t>(m_path_limit));
}
/*
* Encode the extension
*/
-std::vector<byte> Key_Usage::encode_inner() const
+std::vector<uint8_t> Key_Usage::encode_inner() const
{
if(m_constraints == NO_CONSTRAINTS)
throw Encoding_Error("Cannot encode zero usage constraints");
const size_t unused_bits = low_bit(m_constraints) - 1;
- std::vector<byte> der;
+ std::vector<uint8_t> der;
der.push_back(BIT_STRING);
der.push_back(2 + ((unused_bits < 8) ? 1 : 0));
der.push_back(unused_bits % 8);
@@ -340,7 +340,7 @@ std::vector<byte> Key_Usage::encode_inner() const
/*
* Decode the extension
*/
-void Key_Usage::decode_inner(const std::vector<byte>& in)
+void Key_Usage::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder ber(in);
@@ -358,7 +358,7 @@ void Key_Usage::decode_inner(const std::vector<byte>& in)
obj.value[obj.value.size()-1] &= (0xFF << obj.value[0]);
- u16bit usage = 0;
+ uint16_t usage = 0;
for(size_t i = 1; i != obj.value.size(); ++i)
{
usage = (obj.value[i] << 8*(sizeof(usage)-i)) | usage;
@@ -378,7 +378,7 @@ void Key_Usage::contents_to(Data_Store& subject, Data_Store&) const
/*
* Encode the extension
*/
-std::vector<byte> Subject_Key_ID::encode_inner() const
+std::vector<uint8_t> Subject_Key_ID::encode_inner() const
{
return DER_Encoder().encode(m_key_id, OCTET_STRING).get_contents_unlocked();
}
@@ -386,7 +386,7 @@ std::vector<byte> Subject_Key_ID::encode_inner() const
/*
* Decode the extension
*/
-void Subject_Key_ID::decode_inner(const std::vector<byte>& in)
+void Subject_Key_ID::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in).decode(m_key_id, OCTET_STRING).verify_end();
}
@@ -402,13 +402,13 @@ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const
/*
* Subject_Key_ID Constructor
*/
-Subject_Key_ID::Subject_Key_ID(const std::vector<byte>& pub_key) : m_key_id(unlock(SHA_160().process(pub_key)))
+Subject_Key_ID::Subject_Key_ID(const std::vector<uint8_t>& pub_key) : m_key_id(unlock(SHA_160().process(pub_key)))
{}
/*
* Encode the extension
*/
-std::vector<byte> Authority_Key_ID::encode_inner() const
+std::vector<uint8_t> Authority_Key_ID::encode_inner() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
@@ -420,7 +420,7 @@ std::vector<byte> Authority_Key_ID::encode_inner() const
/*
* Decode the extension
*/
-void Authority_Key_ID::decode_inner(const std::vector<byte>& in)
+void Authority_Key_ID::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in)
.start_cons(SEQUENCE)
@@ -439,7 +439,7 @@ void Authority_Key_ID::contents_to(Data_Store&, Data_Store& issuer) const
/*
* Encode the extension
*/
-std::vector<byte> Alternative_Name::encode_inner() const
+std::vector<uint8_t> Alternative_Name::encode_inner() const
{
return DER_Encoder().encode(m_alt_name).get_contents_unlocked();
}
@@ -447,7 +447,7 @@ std::vector<byte> Alternative_Name::encode_inner() const
/*
* Decode the extension
*/
-void Alternative_Name::decode_inner(const std::vector<byte>& in)
+void Alternative_Name::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in).decode(m_alt_name);
}
@@ -499,7 +499,7 @@ Issuer_Alternative_Name::Issuer_Alternative_Name(const AlternativeName& name) :
/*
* Encode the extension
*/
-std::vector<byte> Extended_Key_Usage::encode_inner() const
+std::vector<uint8_t> Extended_Key_Usage::encode_inner() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
@@ -511,7 +511,7 @@ std::vector<byte> Extended_Key_Usage::encode_inner() const
/*
* Decode the extension
*/
-void Extended_Key_Usage::decode_inner(const std::vector<byte>& in)
+void Extended_Key_Usage::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in).decode_list(m_oids);
}
@@ -528,7 +528,7 @@ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const
/*
* Encode the extension
*/
-std::vector<byte> Name_Constraints::encode_inner() const
+std::vector<uint8_t> Name_Constraints::encode_inner() const
{
throw Not_Implemented("Name_Constraints encoding");
}
@@ -537,7 +537,7 @@ std::vector<byte> Name_Constraints::encode_inner() const
/*
* Decode the extension
*/
-void Name_Constraints::decode_inner(const std::vector<byte>& in)
+void Name_Constraints::decode_inner(const std::vector<uint8_t>& in)
{
std::vector<GeneralSubtree> permit, exclude;
BER_Decoder ber(in);
@@ -689,7 +689,7 @@ class Policy_Information : public ASN1_Object
/*
* Encode the extension
*/
-std::vector<byte> Certificate_Policies::encode_inner() const
+std::vector<uint8_t> Certificate_Policies::encode_inner() const
{
std::vector<Policy_Information> policies;
@@ -706,7 +706,7 @@ std::vector<byte> Certificate_Policies::encode_inner() const
/*
* Decode the extension
*/
-void Certificate_Policies::decode_inner(const std::vector<byte>& in)
+void Certificate_Policies::decode_inner(const std::vector<uint8_t>& in)
{
std::vector<Policy_Information> policies;
@@ -726,7 +726,7 @@ void Certificate_Policies::contents_to(Data_Store& info, Data_Store&) const
info.add("X509v3.CertificatePolicies", m_oids[i].as_string());
}
-std::vector<byte> Authority_Information_Access::encode_inner() const
+std::vector<uint8_t> Authority_Information_Access::encode_inner() const
{
ASN1_String url(m_ocsp_responder, IA5_STRING);
@@ -739,7 +739,7 @@ std::vector<byte> Authority_Information_Access::encode_inner() const
.end_cons().get_contents_unlocked();
}
-void Authority_Information_Access::decode_inner(const std::vector<byte>& in)
+void Authority_Information_Access::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder ber = BER_Decoder(in).start_cons(SEQUENCE);
@@ -795,7 +795,7 @@ CRL_Number* CRL_Number::copy() const
/*
* Encode the extension
*/
-std::vector<byte> CRL_Number::encode_inner() const
+std::vector<uint8_t> CRL_Number::encode_inner() const
{
return DER_Encoder().encode(m_crl_number).get_contents_unlocked();
}
@@ -803,7 +803,7 @@ std::vector<byte> CRL_Number::encode_inner() const
/*
* Decode the extension
*/
-void CRL_Number::decode_inner(const std::vector<byte>& in)
+void CRL_Number::decode_inner(const std::vector<uint8_t>& in)
{
BER_Decoder(in).decode(m_crl_number);
}
@@ -813,13 +813,13 @@ void CRL_Number::decode_inner(const std::vector<byte>& in)
*/
void CRL_Number::contents_to(Data_Store& info, Data_Store&) const
{
- info.add("X509v3.CRLNumber", static_cast<u32bit>(m_crl_number));
+ info.add("X509v3.CRLNumber", static_cast<uint32_t>(m_crl_number));
}
/*
* Encode the extension
*/
-std::vector<byte> CRL_ReasonCode::encode_inner() const
+std::vector<uint8_t> CRL_ReasonCode::encode_inner() const
{
return DER_Encoder()
.encode(static_cast<size_t>(m_reason), ENUMERATED, UNIVERSAL)
@@ -829,7 +829,7 @@ std::vector<byte> CRL_ReasonCode::encode_inner() const
/*
* Decode the extension
*/
-void CRL_ReasonCode::decode_inner(const std::vector<byte>& in)
+void CRL_ReasonCode::decode_inner(const std::vector<uint8_t>& in)
{
size_t reason_code = 0;
BER_Decoder(in).decode(reason_code, ENUMERATED, UNIVERSAL);
@@ -844,12 +844,12 @@ void CRL_ReasonCode::contents_to(Data_Store& info, Data_Store&) const
info.add("X509v3.CRLReasonCode", m_reason);
}
-std::vector<byte> CRL_Distribution_Points::encode_inner() const
+std::vector<uint8_t> CRL_Distribution_Points::encode_inner() const
{
throw Not_Implemented("CRL_Distribution_Points encoding");
}
-void CRL_Distribution_Points::decode_inner(const std::vector<byte>& buf)
+void CRL_Distribution_Points::decode_inner(const std::vector<uint8_t>& buf)
{
BER_Decoder(buf).decode_list(m_distribution_points).verify_end();
}
@@ -882,12 +882,12 @@ void CRL_Distribution_Points::Distribution_Point::decode_from(class BER_Decoder&
.end_cons().end_cons();
}
-std::vector<byte> Unknown_Critical_Extension::encode_inner() const
+std::vector<uint8_t> Unknown_Critical_Extension::encode_inner() const
{
throw Not_Implemented("Unknown_Critical_Extension encoding");
}
-void Unknown_Critical_Extension::decode_inner(const std::vector<byte>&)
+void Unknown_Critical_Extension::decode_inner(const std::vector<uint8_t>&)
{
}
diff --git a/src/lib/x509/x509_ext.h b/src/lib/x509/x509_ext.h
index 1657613e7..f00535eb2 100644
--- a/src/lib/x509/x509_ext.h
+++ b/src/lib/x509/x509_ext.h
@@ -76,8 +76,8 @@ class BOTAN_DLL Certificate_Extension
protected:
friend class Extensions;
virtual bool should_encode() const { return true; }
- virtual std::vector<byte> encode_inner() const = 0;
- virtual void decode_inner(const std::vector<byte>&) = 0;
+ virtual std::vector<uint8_t> encode_inner() const = 0;
+ virtual void decode_inner(const std::vector<uint8_t>&) = 0;
};
/**
@@ -152,7 +152,7 @@ class BOTAN_DLL Extensions : public ASN1_Object
* together with the corresponding criticality flag.
* Contains all extensions, known as well as unknown extensions.
*/
- std::map<OID, std::pair<std::vector<byte>, bool>> extensions_raw() const;
+ std::map<OID, std::pair<std::vector<uint8_t>, bool>> extensions_raw() const;
Extensions& operator=(const Extensions&);
@@ -169,7 +169,7 @@ class BOTAN_DLL Extensions : public ASN1_Object
std::vector<std::pair<std::unique_ptr<Certificate_Extension>, bool>> m_extensions;
bool m_throw_on_unknown_critical;
- std::map<OID, std::pair<std::vector<byte>, bool>> m_extensions_raw;
+ std::map<OID, std::pair<std::vector<uint8_t>, bool>> m_extensions_raw;
};
namespace Cert_Extension {
@@ -195,8 +195,8 @@ class BOTAN_DLL Basic_Constraints final : public Certificate_Extension
std::string oid_name() const override
{ return "X509v3.BasicConstraints"; }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
bool m_is_ca;
@@ -220,8 +220,8 @@ class BOTAN_DLL Key_Usage final : public Certificate_Extension
bool should_encode() const override
{ return (m_constraints != NO_CONSTRAINTS); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
Key_Constraints m_constraints;
@@ -237,19 +237,19 @@ class BOTAN_DLL Subject_Key_ID final : public Certificate_Extension
{ return new Subject_Key_ID(m_key_id); }
Subject_Key_ID() {}
- explicit Subject_Key_ID(const std::vector<byte>&);
+ explicit Subject_Key_ID(const std::vector<uint8_t>&);
- std::vector<byte> get_key_id() const { return m_key_id; }
+ std::vector<uint8_t> get_key_id() const { return m_key_id; }
private:
std::string oid_name() const override
{ return "X509v3.SubjectKeyIdentifier"; }
bool should_encode() const override { return (m_key_id.size() > 0); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
- std::vector<byte> m_key_id;
+ std::vector<uint8_t> m_key_id;
};
/**
@@ -262,20 +262,20 @@ class BOTAN_DLL Authority_Key_ID final : public Certificate_Extension
{ return new Authority_Key_ID(m_key_id); }
Authority_Key_ID() {}
- explicit Authority_Key_ID(const std::vector<byte>& k) : m_key_id(k) {}
+ explicit Authority_Key_ID(const std::vector<uint8_t>& k) : m_key_id(k) {}
- std::vector<byte> get_key_id() const { return m_key_id; }
+ std::vector<uint8_t> get_key_id() const { return m_key_id; }
private:
std::string oid_name() const override
{ return "X509v3.AuthorityKeyIdentifier"; }
bool should_encode() const override { return (m_key_id.size() > 0); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
- std::vector<byte> m_key_id;
+ std::vector<uint8_t> m_key_id;
};
/**
@@ -295,8 +295,8 @@ class BOTAN_DLL Alternative_Name : public Certificate_Extension
std::string oid_name() const override { return m_oid_name_str; }
bool should_encode() const override { return m_alt_name.has_items(); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
std::string m_oid_name_str;
@@ -346,8 +346,8 @@ class BOTAN_DLL Extended_Key_Usage final : public Certificate_Extension
{ return "X509v3.ExtendedKeyUsage"; }
bool should_encode() const override { return (m_oids.size() > 0); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
std::vector<OID> m_oids;
@@ -375,8 +375,8 @@ class BOTAN_DLL Name_Constraints : public Certificate_Extension
{ return "X509v3.NameConstraints"; }
bool should_encode() const override { return true; }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
NameConstraints m_name_constraints;
@@ -401,8 +401,8 @@ class BOTAN_DLL Certificate_Policies final : public Certificate_Extension
{ return "X509v3.CertificatePolicies"; }
bool should_encode() const override { return (m_oids.size() > 0); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
std::vector<OID> m_oids;
@@ -425,8 +425,8 @@ class BOTAN_DLL Authority_Information_Access final : public Certificate_Extensio
bool should_encode() const override { return (!m_ocsp_responder.empty()); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
@@ -450,8 +450,8 @@ class BOTAN_DLL CRL_Number final : public Certificate_Extension
std::string oid_name() const override { return "X509v3.CRLNumber"; }
bool should_encode() const override { return m_has_value; }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
bool m_has_value;
@@ -475,8 +475,8 @@ class BOTAN_DLL CRL_ReasonCode final : public Certificate_Extension
std::string oid_name() const override { return "X509v3.ReasonCode"; }
bool should_encode() const override { return (m_reason != UNSPECIFIED); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
CRL_Code m_reason;
@@ -517,8 +517,8 @@ class BOTAN_DLL CRL_Distribution_Points final : public Certificate_Extension
bool should_encode() const override
{ return !m_distribution_points.empty(); }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
std::vector<Distribution_Point> m_distribution_points;
@@ -552,8 +552,8 @@ class BOTAN_DLL Unknown_Critical_Extension final : public Certificate_Extension
{ return "Unknown OID name"; }
bool should_encode() const override { return false; }
- std::vector<byte> encode_inner() const override;
- void decode_inner(const std::vector<byte>&) override;
+ std::vector<uint8_t> encode_inner() const override;
+ void decode_inner(const std::vector<uint8_t>&) override;
void contents_to(Data_Store&, Data_Store&) const override;
OID m_oid;
diff --git a/src/lib/x509/x509_obj.cpp b/src/lib/x509/x509_obj.cpp
index 3c5d2a9b4..cc97c1f15 100644
--- a/src/lib/x509/x509_obj.cpp
+++ b/src/lib/x509/x509_obj.cpp
@@ -39,7 +39,7 @@ X509_Object::X509_Object(const std::string& file, const std::string& labels)
/*
* Create a generic X.509 object
*/
-X509_Object::X509_Object(const std::vector<byte>& vec, const std::string& labels)
+X509_Object::X509_Object(const std::vector<uint8_t>& vec, const std::string& labels)
{
DataSource_Memory stream(vec.data(), vec.size());
init(stream, labels);
@@ -112,7 +112,7 @@ void X509_Object::decode_from(BER_Decoder& from)
/*
* Return a BER encoded X.509 object
*/
-std::vector<byte> X509_Object::BER_encode() const
+std::vector<uint8_t> X509_Object::BER_encode() const
{
DER_Encoder der;
encode_into(der);
@@ -130,7 +130,7 @@ std::string X509_Object::PEM_encode() const
/*
* Return the TBS data
*/
-std::vector<byte> X509_Object::tbs_data() const
+std::vector<uint8_t> X509_Object::tbs_data() const
{
return ASN1::put_in_sequence(m_tbs_bits);
}
@@ -138,7 +138,7 @@ std::vector<byte> X509_Object::tbs_data() const
/*
* Return the signature of this object
*/
-std::vector<byte> X509_Object::signature() const
+std::vector<uint8_t> X509_Object::signature() const
{
return m_sig;
}
@@ -212,10 +212,10 @@ bool X509_Object::check_signature(const Public_Key& pub_key) const
/*
* Apply the X.509 SIGNED macro
*/
-std::vector<byte> X509_Object::make_signed(PK_Signer* signer,
+std::vector<uint8_t> X509_Object::make_signed(PK_Signer* signer,
RandomNumberGenerator& rng,
const AlgorithmIdentifier& algo,
- const secure_vector<byte>& tbs_bits)
+ const secure_vector<uint8_t>& tbs_bits)
{
return DER_Encoder()
.start_cons(SEQUENCE)
diff --git a/src/lib/x509/x509_obj.h b/src/lib/x509/x509_obj.h
index 40324775c..c2bf7b9c2 100644
--- a/src/lib/x509/x509_obj.h
+++ b/src/lib/x509/x509_obj.h
@@ -26,12 +26,12 @@ class BOTAN_DLL X509_Object : public ASN1_Object
* The underlying data that is to be or was signed
* @return data that is or was signed
*/
- std::vector<byte> tbs_data() const;
+ std::vector<uint8_t> tbs_data() const;
/**
* @return signature on tbs_data()
*/
- std::vector<byte> signature() const;
+ std::vector<uint8_t> signature() const;
/**
* @return signature algorithm that was used to generate signature
@@ -51,10 +51,10 @@ class BOTAN_DLL X509_Object : public ASN1_Object
* @param tbs the tbs bits to be signed
* @return signed X509 object
*/
- static std::vector<byte> make_signed(class PK_Signer* signer,
+ static std::vector<uint8_t> make_signed(class PK_Signer* signer,
RandomNumberGenerator& rng,
const AlgorithmIdentifier& alg_id,
- const secure_vector<byte>& tbs);
+ const secure_vector<uint8_t>& tbs);
/**
* Check the signature on this data
@@ -86,7 +86,7 @@ class BOTAN_DLL X509_Object : public ASN1_Object
/**
* @return BER encoding of this
*/
- std::vector<byte> BER_encode() const;
+ std::vector<uint8_t> BER_encode() const;
/**
* @return PEM encoding of this
@@ -96,7 +96,7 @@ class BOTAN_DLL X509_Object : public ASN1_Object
virtual ~X509_Object() {}
protected:
X509_Object(DataSource& src, const std::string& pem_labels);
- X509_Object(const std::vector<byte>& vec, const std::string& labels);
+ X509_Object(const std::vector<uint8_t>& vec, const std::string& labels);
#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
X509_Object(const std::string& file, const std::string& pem_labels);
@@ -105,7 +105,7 @@ class BOTAN_DLL X509_Object : public ASN1_Object
void do_decode();
X509_Object() {}
AlgorithmIdentifier m_sig_algo;
- std::vector<byte> m_tbs_bits, m_sig;
+ std::vector<uint8_t> m_tbs_bits, m_sig;
private:
virtual void force_decode() = 0;
void init(DataSource&, const std::string&);
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp
index 52802a8e4..e53034dce 100644
--- a/src/lib/x509/x509cert.cpp
+++ b/src/lib/x509/x509cert.cpp
@@ -66,7 +66,7 @@ X509_Certificate::X509_Certificate(const std::string& fsname) :
/*
* X509_Certificate Constructor
*/
-X509_Certificate::X509_Certificate(const std::vector<byte>& in) :
+X509_Certificate::X509_Certificate(const std::vector<uint8_t>& in) :
X509_Object(in, "CERTIFICATE/X509 CERTIFICATE"),
m_self_signed(false),
m_v3_extensions(false)
@@ -116,7 +116,7 @@ void X509_Certificate::force_decode()
throw BER_Bad_Tag("X509_Certificate: Unexpected tag for public key",
public_key.type_tag, public_key.class_tag);
- std::vector<byte> v2_issuer_key_id, v2_subject_key_id;
+ std::vector<uint8_t> v2_issuer_key_id, v2_subject_key_id;
tbs_cert.decode_optional_string(v2_issuer_key_id, BIT_STRING, 1);
tbs_cert.decode_optional_string(v2_subject_key_id, BIT_STRING, 2);
@@ -135,7 +135,7 @@ void X509_Certificate::force_decode()
if(tbs_cert.more_items())
throw Decoding_Error("TBSCertificate has more items that expected");
- m_subject.add("X509.Certificate.version", static_cast<u32bit>(version));
+ m_subject.add("X509.Certificate.version", static_cast<uint32_t>(version));
m_subject.add("X509.Certificate.serial", BigInt::encode(serial_bn));
m_subject.add("X509.Certificate.start", start.to_string());
m_subject.add("X509.Certificate.end", end.to_string());
@@ -164,16 +164,16 @@ void X509_Certificate::force_decode()
const size_t limit = (x509_version() < 3) ?
Cert_Extension::NO_CERT_PATH_LIMIT : 0;
- m_subject.add("X509v3.BasicConstraints.path_constraint", static_cast<u32bit>(limit));
+ m_subject.add("X509v3.BasicConstraints.path_constraint", static_cast<uint32_t>(limit));
}
}
/*
* Return the X.509 version in use
*/
-u32bit X509_Certificate::x509_version() const
+uint32_t X509_Certificate::x509_version() const
{
- return (m_subject.get1_u32bit("X509.Certificate.version") + 1);
+ return (m_subject.get1_uint32("X509.Certificate.version") + 1);
}
/*
@@ -219,18 +219,18 @@ Public_Key* X509_Certificate::subject_public_key() const
ASN1::put_in_sequence(this->subject_public_key_bits()));
}
-std::vector<byte> X509_Certificate::subject_public_key_bits() const
+std::vector<uint8_t> X509_Certificate::subject_public_key_bits() const
{
return hex_decode(m_subject.get1("X509.Certificate.public_key"));
}
-std::vector<byte> X509_Certificate::subject_public_key_bitstring() const
+std::vector<uint8_t> X509_Certificate::subject_public_key_bitstring() const
{
// TODO: cache this
- const std::vector<byte> key_bits = subject_public_key_bits();
+ const std::vector<uint8_t> key_bits = subject_public_key_bits();
AlgorithmIdentifier public_key_algid;
- std::vector<byte> public_key_bitstr;
+ std::vector<uint8_t> public_key_bitstr;
BER_Decoder(key_bits)
.decode(public_key_algid)
@@ -239,7 +239,7 @@ std::vector<byte> X509_Certificate::subject_public_key_bitstring() const
return public_key_bitstr;
}
-std::vector<byte> X509_Certificate::subject_public_key_bitstring_sha1() const
+std::vector<uint8_t> X509_Certificate::subject_public_key_bitstring_sha1() const
{
// TODO: cache this value
std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-1"));
@@ -252,7 +252,7 @@ std::vector<byte> X509_Certificate::subject_public_key_bitstring_sha1() const
*/
bool X509_Certificate::is_CA_cert() const
{
- if(!m_subject.get1_u32bit("X509v3.BasicConstraints.is_ca"))
+ if(!m_subject.get1_uint32("X509v3.BasicConstraints.is_ca"))
return false;
return allowed_usage(Key_Constraints(KEY_CERT_SIGN));
@@ -333,9 +333,9 @@ bool X509_Certificate::has_ex_constraint(const std::string& ex_constraint) const
/*
* Return the path length constraint
*/
-u32bit X509_Certificate::path_limit() const
+uint32_t X509_Certificate::path_limit() const
{
- return m_subject.get1_u32bit("X509v3.BasicConstraints.path_constraint", 0);
+ return m_subject.get1_uint32("X509v3.BasicConstraints.path_constraint", 0);
}
/*
@@ -343,7 +343,7 @@ u32bit X509_Certificate::path_limit() const
*/
bool X509_Certificate::is_critical(const std::string& ex_name) const
{
- return !!m_subject.get1_u32bit(ex_name + ".is_critical",0);
+ return !!m_subject.get1_uint32(ex_name + ".is_critical",0);
}
/*
@@ -351,7 +351,7 @@ bool X509_Certificate::is_critical(const std::string& ex_name) const
*/
Key_Constraints X509_Certificate::constraints() const
{
- return Key_Constraints(m_subject.get1_u32bit("X509v3.KeyUsage",
+ return Key_Constraints(m_subject.get1_uint32("X509v3.KeyUsage",
NO_CONSTRAINTS));
}
@@ -409,7 +409,7 @@ std::string X509_Certificate::crl_distribution_point() const
/*
* Return the authority key id
*/
-std::vector<byte> X509_Certificate::authority_key_id() const
+std::vector<uint8_t> X509_Certificate::authority_key_id() const
{
return m_issuer.get1_memvec("X509v3.AuthorityKeyIdentifier");
}
@@ -417,7 +417,7 @@ std::vector<byte> X509_Certificate::authority_key_id() const
/*
* Return the subject key id
*/
-std::vector<byte> X509_Certificate::subject_key_id() const
+std::vector<uint8_t> X509_Certificate::subject_key_id() const
{
return m_subject.get1_memvec("X509v3.SubjectKeyIdentifier");
}
@@ -425,7 +425,7 @@ std::vector<byte> X509_Certificate::subject_key_id() const
/*
* Return the certificate serial number
*/
-std::vector<byte> X509_Certificate::serial_number() const
+std::vector<uint8_t> X509_Certificate::serial_number() const
{
return m_subject.get1_memvec("X509.Certificate.serial");
}
@@ -435,7 +435,7 @@ X509_DN X509_Certificate::issuer_dn() const
return create_dn(m_issuer);
}
-std::vector<byte> X509_Certificate::raw_issuer_dn() const
+std::vector<uint8_t> X509_Certificate::raw_issuer_dn() const
{
return m_issuer.get1_memvec("X509.Certificate.dn_bits");
}
@@ -445,7 +445,7 @@ X509_DN X509_Certificate::subject_dn() const
return create_dn(m_subject);
}
-std::vector<byte> X509_Certificate::raw_subject_dn() const
+std::vector<uint8_t> X509_Certificate::raw_subject_dn() const
{
return m_subject.get1_memvec("X509.Certificate.dn_bits");
}
diff --git a/src/lib/x509/x509cert.h b/src/lib/x509/x509cert.h
index 5cf7c81fa..c6887f4e5 100644
--- a/src/lib/x509/x509cert.h
+++ b/src/lib/x509/x509cert.h
@@ -46,20 +46,20 @@ class BOTAN_DLL X509_Certificate : public X509_Object
* Get the public key associated with this certificate.
* @return subject public key of this certificate
*/
- std::vector<byte> subject_public_key_bits() const;
+ std::vector<uint8_t> subject_public_key_bits() const;
/**
* Get the bit string of the public key associated with this certificate
* @return subject public key of this certificate
*/
- std::vector<byte> subject_public_key_bitstring() const;
+ std::vector<uint8_t> subject_public_key_bitstring() const;
/**
* Get the SHA-1 bit string of the public key associated with this certificate.
* This is used for OCSP among other protocols
* @return hash of subject public key of this certificate
*/
- std::vector<byte> subject_public_key_bitstring_sha1() const;
+ std::vector<uint8_t> subject_public_key_bitstring_sha1() const;
/**
* Get the certificate's issuer distinguished name (DN).
@@ -98,12 +98,12 @@ class BOTAN_DLL X509_Certificate : public X509_Object
/**
* Raw subject DN
*/
- std::vector<byte> raw_issuer_dn() const;
+ std::vector<uint8_t> raw_issuer_dn() const;
/**
* Raw issuer DN
*/
- std::vector<byte> raw_subject_dn() const;
+ std::vector<uint8_t> raw_subject_dn() const;
/**
* Get the notBefore of the certificate.
@@ -121,25 +121,25 @@ class BOTAN_DLL X509_Certificate : public X509_Object
* Get the X509 version of this certificate object.
* @return X509 version
*/
- u32bit x509_version() const;
+ uint32_t x509_version() const;
/**
* Get the serial number of this certificate.
* @return certificates serial number
*/
- std::vector<byte> serial_number() const;
+ std::vector<uint8_t> serial_number() const;
/**
* Get the DER encoded AuthorityKeyIdentifier of this certificate.
* @return DER encoded AuthorityKeyIdentifier
*/
- std::vector<byte> authority_key_id() const;
+ std::vector<uint8_t> authority_key_id() const;
/**
* Get the DER encoded SubjectKeyIdentifier of this certificate.
* @return DER encoded SubjectKeyIdentifier
*/
- std::vector<byte> subject_key_id() const;
+ std::vector<uint8_t> subject_key_id() const;
/**
* Check whether this certificate is self signed.
@@ -191,7 +191,7 @@ class BOTAN_DLL X509_Certificate : public X509_Object
* this certificate.
* @return path limit
*/
- u32bit path_limit() const;
+ uint32_t path_limit() const;
/**
* Check whenever a given X509 Extension is marked critical in this
@@ -293,7 +293,7 @@ class BOTAN_DLL X509_Certificate : public X509_Object
* Create a certificate from a buffer
* @param in the buffer containing the DER-encoded certificate
*/
- explicit X509_Certificate(const std::vector<byte>& in);
+ explicit X509_Certificate(const std::vector<uint8_t>& in);
X509_Certificate(const X509_Certificate& other) = default;
diff --git a/src/lib/x509/x509opt.cpp b/src/lib/x509/x509opt.cpp
index 2dd2098fe..79c735a0f 100644
--- a/src/lib/x509/x509opt.cpp
+++ b/src/lib/x509/x509opt.cpp
@@ -65,7 +65,7 @@ void X509_Cert_Options::CA_key(size_t limit)
* Initialize the certificate options
*/
X509_Cert_Options::X509_Cert_Options(const std::string& initial_opts,
- u32bit expiration_time)
+ uint32_t expiration_time)
{
is_CA = false;
path_limit = 0;
diff --git a/src/lib/x509/x509path.cpp b/src/lib/x509/x509path.cpp
index 5c1e94ff8..37314a154 100644
--- a/src/lib/x509/x509path.cpp
+++ b/src/lib/x509/x509path.cpp
@@ -443,7 +443,7 @@ PKIX::build_certificate_path(std::vector<std::shared_ptr<const X509_Certificate>
{
const X509_Certificate& last = *cert_path.back();
const X509_DN issuer_dn = last.issuer_dn();
- const std::vector<byte> auth_key_id = last.authority_key_id();
+ const std::vector<uint8_t> auth_key_id = last.authority_key_id();
std::shared_ptr<const X509_Certificate> issuer;
bool trusted_issuer = false;
diff --git a/src/lib/x509/x509self.cpp b/src/lib/x509/x509self.cpp
index fe0336014..b8f8fbdc8 100644
--- a/src/lib/x509/x509self.cpp
+++ b/src/lib/x509/x509self.cpp
@@ -50,7 +50,7 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts,
X509_DN subject_dn;
AlternativeName subject_alt;
- std::vector<byte> pub_key = X509::BER_encode(key);
+ std::vector<uint8_t> pub_key = X509::BER_encode(key);
std::unique_ptr<PK_Signer> signer(choose_sig_format(key, rng, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);
@@ -102,7 +102,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
X509_DN subject_dn;
AlternativeName subject_alt;
- std::vector<byte> pub_key = X509::BER_encode(key);
+ std::vector<uint8_t> pub_key = X509::BER_encode(key);
std::unique_ptr<PK_Signer> signer(choose_sig_format(key, rng, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);
@@ -165,7 +165,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
.end_explicit()
.end_cons();
- const std::vector<byte> req =
+ const std::vector<uint8_t> req =
X509_Object::make_signed(signer.get(), rng, sig_algo,
tbs_req.get_contents());
diff --git a/src/lib/x509/x509self.h b/src/lib/x509/x509self.h
index 008eece51..156e41f8a 100644
--- a/src/lib/x509/x509self.h
+++ b/src/lib/x509/x509self.h
@@ -163,7 +163,7 @@ class BOTAN_DLL X509_Cert_Options
* @param expire_time the expiration time (from the current clock in seconds)
*/
X509_Cert_Options(const std::string& opts = "",
- u32bit expire_time = 365 * 24 * 60 * 60);
+ uint32_t expire_time = 365 * 24 * 60 * 60);
};
namespace X509 {