diff options
Diffstat (limited to 'src/lib/prov/pkcs11')
-rw-r--r-- | src/lib/prov/pkcs11/p11.h | 52 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecc_key.cpp | 22 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecc_key.h | 26 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdh.cpp | 8 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdh.h | 6 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdsa.cpp | 20 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdsa.h | 4 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_mechanism.h | 8 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_object.cpp | 28 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_object.h | 50 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_randomgenerator.cpp | 6 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_randomgenerator.h | 4 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_rsa.cpp | 32 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_rsa.h | 2 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_x509.cpp | 2 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_x509.h | 20 |
16 files changed, 145 insertions, 145 deletions
diff --git a/src/lib/prov/pkcs11/p11.h b/src/lib/prov/pkcs11/p11.h index 72abcd611..efc887e11 100644 --- a/src/lib/prov/pkcs11/p11.h +++ b/src/lib/prov/pkcs11/p11.h @@ -58,7 +58,7 @@ static_assert(CRYPTOKI_VERSION_MAJOR == 2 && CRYPTOKI_VERSION_MINOR == 40, namespace Botan { namespace PKCS11 { -using secure_string = secure_vector<byte>; +using secure_string = secure_vector<uint8_t>; enum class AttributeType : CK_ATTRIBUTE_TYPE { @@ -1149,7 +1149,7 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_InitToken(SlotId slot_id, - const std::vector<byte, TAlloc>& so_pin, + const std::vector<uint8_t, TAlloc>& so_pin, const std::string& label, ReturnValue* return_value = ThrowException) const { @@ -1159,7 +1159,7 @@ class BOTAN_DLL LowLevel padded_label.insert(padded_label.end(), 32 - label.size(), ' '); } - return C_InitToken(slot_id, reinterpret_cast< Utf8Char* >(const_cast< byte* >(so_pin.data())), + return C_InitToken(slot_id, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(so_pin.data())), so_pin.size(), reinterpret_cast< Utf8Char* >(const_cast< char* >(padded_label.c_str())), return_value); } @@ -1201,10 +1201,10 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_InitPIN(SessionHandle session, - const std::vector<byte, TAlloc>& pin, + const std::vector<uint8_t, TAlloc>& pin, ReturnValue* return_value = ThrowException) const { - return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< byte* >(pin.data())), pin.size(), return_value); + return C_InitPIN(session, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(), return_value); } /** @@ -1250,13 +1250,13 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_SetPIN(SessionHandle session, - const std::vector<byte, TAlloc>& old_pin, - const std::vector<byte, TAlloc>& new_pin, + const std::vector<uint8_t, TAlloc>& old_pin, + const std::vector<uint8_t, TAlloc>& new_pin, ReturnValue* return_value = ThrowException) const { return C_SetPIN(session, - reinterpret_cast< Utf8Char* >(const_cast< byte* >(old_pin.data())), old_pin.size(), - reinterpret_cast< Utf8Char* >(const_cast< byte* >(new_pin.data())), new_pin.size(), + reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(old_pin.data())), old_pin.size(), + reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(new_pin.data())), new_pin.size(), return_value); } @@ -1423,10 +1423,10 @@ class BOTAN_DLL LowLevel template<typename TAlloc> bool C_Login(SessionHandle session, UserType user_type, - const std::vector<byte, TAlloc>& pin, + const std::vector<uint8_t, TAlloc>& pin, ReturnValue* return_value = ThrowException) const { - return C_Login(session, user_type, reinterpret_cast< Utf8Char* >(const_cast< byte* >(pin.data())), pin.size(), + return C_Login(session, user_type, reinterpret_cast< Utf8Char* >(const_cast< uint8_t* >(pin.data())), pin.size(), return_value); } @@ -1576,7 +1576,7 @@ class BOTAN_DLL LowLevel template<typename TAlloc> bool C_GetAttributeValue(SessionHandle session, ObjectHandle object, - std::map<AttributeType, std::vector<byte, TAlloc>>& attribute_values, + std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values, ReturnValue* return_value = ThrowException) const { std::vector<Attribute> getter_template; @@ -1599,7 +1599,7 @@ class BOTAN_DLL LowLevel { entry.second.clear(); entry.second.resize(getter_template.at(i).ulValueLen); - getter_template.at(i).pValue = const_cast< byte* >(entry.second.data()); + getter_template.at(i).pValue = const_cast< uint8_t* >(entry.second.data()); i++; } @@ -1651,7 +1651,7 @@ class BOTAN_DLL LowLevel template<typename TAlloc> bool C_SetAttributeValue(SessionHandle session, ObjectHandle object, - std::map<AttributeType, std::vector<byte, TAlloc>>& attribute_values, + std::map<AttributeType, std::vector<uint8_t, TAlloc>>& attribute_values, ReturnValue* return_value = ThrowException) const { std::vector<Attribute> setter_template; @@ -1788,8 +1788,8 @@ class BOTAN_DLL LowLevel */ template<typename TAllocA, typename TAllocB> bool C_Encrypt(SessionHandle session, - const std::vector<byte, TAllocA>& plaintext_data, - std::vector<byte, TAllocB>& encrypted_data, + const std::vector<uint8_t, TAllocA>& plaintext_data, + std::vector<uint8_t, TAllocB>& encrypted_data, ReturnValue* return_value = ThrowException) const { Ulong encrypted_size = 0; @@ -1915,8 +1915,8 @@ class BOTAN_DLL LowLevel */ template<typename TAllocA, typename TAllocB> bool C_Decrypt(SessionHandle session, - const std::vector<byte, TAllocA>& encrypted_data, - std::vector<byte, TAllocB>& decrypted_data, + const std::vector<uint8_t, TAllocA>& encrypted_data, + std::vector<uint8_t, TAllocB>& decrypted_data, ReturnValue* return_value = ThrowException) const { Ulong decrypted_size = 0; @@ -2064,7 +2064,7 @@ class BOTAN_DLL LowLevel * C_DigestFinal finishes a multiple-part message-digesting operation. * @param session the session's handle * @param digest_ptr gets the message digest - * @param digest_len_ptr gets byte count of digest + * @param digest_len_ptr gets uint8_t count of digest * @param return_value default value (`ThrowException`): throw exception on error. * if a non-NULL pointer is passed: return_value receives the return value of the PKCS#11 function and no exception is thrown. * At least the following PKCS#11 return values may be returned: @@ -2147,8 +2147,8 @@ class BOTAN_DLL LowLevel */ template<typename TAllocA, typename TAllocB> bool C_Sign(SessionHandle session, - const std::vector<byte, TAllocA>& data, - std::vector<byte, TAllocB>& signature, + const std::vector<uint8_t, TAllocA>& data, + std::vector<uint8_t, TAllocB>& signature, ReturnValue* return_value = ThrowException) const { Ulong signature_size = 0; @@ -2197,7 +2197,7 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_SignUpdate(SessionHandle session, - const std::vector<byte, TAlloc>& part, + const std::vector<uint8_t, TAlloc>& part, ReturnValue* return_value = ThrowException) const { return C_SignUpdate(session, const_cast<Byte*>(part.data()), part.size(), return_value); @@ -2241,7 +2241,7 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_SignFinal(SessionHandle session, - std::vector<byte, TAlloc>& signature, + std::vector<uint8_t, TAlloc>& signature, ReturnValue* return_value = ThrowException) const { Ulong signature_size = 0; @@ -2368,8 +2368,8 @@ class BOTAN_DLL LowLevel */ template<typename TAllocA, typename TAllocB> bool C_Verify(SessionHandle session, - const std::vector<byte, TAllocA>& data, - std::vector<byte, TAllocB>& signature, + const std::vector<uint8_t, TAllocA>& data, + std::vector<uint8_t, TAllocB>& signature, ReturnValue* return_value = ThrowException) const { return C_Verify(session, const_cast<Byte*>(data.data()), data.size(), signature.data(), signature.size(), return_value); @@ -2411,7 +2411,7 @@ class BOTAN_DLL LowLevel */ template<typename TAlloc> bool C_VerifyUpdate(SessionHandle session, - std::vector<byte, TAlloc> part, + std::vector<uint8_t, TAlloc> part, ReturnValue* return_value = ThrowException) const { return C_VerifyUpdate(session, part.data(), part.size(), return_value); diff --git a/src/lib/prov/pkcs11/p11_ecc_key.cpp b/src/lib/prov/pkcs11/p11_ecc_key.cpp index 527daceaf..9366594a6 100644 --- a/src/lib/prov/pkcs11/p11_ecc_key.cpp +++ b/src/lib/prov/pkcs11/p11_ecc_key.cpp @@ -17,22 +17,22 @@ namespace Botan { namespace PKCS11 { namespace { /// Converts a DER-encoded ANSI X9.62 ECPoint to PointGFp -PointGFp decode_public_point(const secure_vector<byte>& ec_point_data, const CurveGFp& curve) +PointGFp decode_public_point(const secure_vector<uint8_t>& ec_point_data, const CurveGFp& curve) { - secure_vector<byte> ec_point; + secure_vector<uint8_t> ec_point; BER_Decoder(ec_point_data).decode(ec_point, OCTET_STRING); return OS2ECP(ec_point, curve); } } -EC_PublicKeyGenerationProperties::EC_PublicKeyGenerationProperties(const std::vector<byte>& ec_params) +EC_PublicKeyGenerationProperties::EC_PublicKeyGenerationProperties(const std::vector<uint8_t>& ec_params) : PublicKeyProperties(KeyType::Ec), m_ec_params(ec_params) { add_binary(AttributeType::EcParams, m_ec_params); } -EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<byte>& ec_params, - const std::vector<byte>& ec_point) +EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<uint8_t>& ec_params, + const std::vector<uint8_t>& ec_point) : PublicKeyProperties(KeyType::Ec), m_ec_params(ec_params), m_ec_point(ec_point) { add_binary(AttributeType::EcParams, m_ec_params); @@ -42,7 +42,7 @@ EC_PublicKeyImportProperties::EC_PublicKeyImportProperties(const std::vector<byt PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, ObjectHandle handle) : Object(session, handle) { - secure_vector<byte> ec_parameters = get_attribute_value(AttributeType::EcParams); + secure_vector<uint8_t> ec_parameters = get_attribute_value(AttributeType::EcParams); m_domain_params = EC_Group(unlock(ec_parameters)); m_public_key = decode_public_point(get_attribute_value(AttributeType::EcPoint), m_domain_params.get_curve()); m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT; @@ -53,13 +53,13 @@ PKCS11_EC_PublicKey::PKCS11_EC_PublicKey(Session& session, const EC_PublicKeyImp { m_domain_params = EC_Group(props.ec_params()); - secure_vector<byte> ec_point; + secure_vector<uint8_t> ec_point; BER_Decoder(props.ec_point()).decode(ec_point, OCTET_STRING); m_public_key = OS2ECP(ec_point, m_domain_params.get_curve()); m_domain_encoding = EC_DOMPAR_ENC_EXPLICIT; } -EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<byte>& ec_params, const BigInt& value) +EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<uint8_t>& ec_params, const BigInt& value) : PrivateKeyProperties(KeyType::Ec), m_ec_params(ec_params), m_value(value) { add_binary(AttributeType::EcParams, m_ec_params); @@ -69,7 +69,7 @@ EC_PrivateKeyImportProperties::EC_PrivateKeyImportProperties(const std::vector<b PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, ObjectHandle handle) : Object(session, handle), m_domain_params(), m_public_key() { - secure_vector<byte> ec_parameters = get_attribute_value(AttributeType::EcParams); + secure_vector<uint8_t> ec_parameters = get_attribute_value(AttributeType::EcParams); m_domain_params = EC_Group(unlock(ec_parameters)); } @@ -79,7 +79,7 @@ PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const EC_PrivateKey m_domain_params = EC_Group(props.ec_params()); } -PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<byte>& ec_params, +PKCS11_EC_PrivateKey::PKCS11_EC_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params, const EC_PrivateKeyGenerationProperties& props) : Object(session) { @@ -106,7 +106,7 @@ size_t PKCS11_EC_PrivateKey::key_length() const return m_domain_params.get_order().bits(); } -std::vector<byte> PKCS11_EC_PrivateKey::public_key_bits() const +std::vector<uint8_t> PKCS11_EC_PrivateKey::public_key_bits() const { return unlock(EC2OSP(public_point(), PointGFp::COMPRESSED)); } diff --git a/src/lib/prov/pkcs11/p11_ecc_key.h b/src/lib/prov/pkcs11/p11_ecc_key.h index 69e612c33..6762d448e 100644 --- a/src/lib/prov/pkcs11/p11_ecc_key.h +++ b/src/lib/prov/pkcs11/p11_ecc_key.h @@ -30,16 +30,16 @@ class BOTAN_DLL EC_PublicKeyGenerationProperties final : public PublicKeyPropert { public: /// @param ec_params DER-encoding of an ANSI X9.62 Parameters value - EC_PublicKeyGenerationProperties(const std::vector<byte>& ec_params); + EC_PublicKeyGenerationProperties(const std::vector<uint8_t>& ec_params); /// @return the DER-encoding of the ec parameters according to ANSI X9.62 - inline const std::vector<byte>& ec_params() const + inline const std::vector<uint8_t>& ec_params() const { return m_ec_params; } private: - const std::vector<byte> m_ec_params; + const std::vector<uint8_t> m_ec_params; }; /// Properties for importing a PKCS#11 EC public key @@ -50,23 +50,23 @@ class BOTAN_DLL EC_PublicKeyImportProperties final : public PublicKeyProperties * @param ec_params DER-encoding of an ANSI X9.62 Parameters value * @param ec_point DER-encoding of ANSI X9.62 ECPoint value Q */ - EC_PublicKeyImportProperties(const std::vector<byte>& ec_params, const std::vector<byte>& ec_point); + EC_PublicKeyImportProperties(const std::vector<uint8_t>& ec_params, const std::vector<uint8_t>& ec_point); /// @return the DER-encoding of the ec parameters according to ANSI X9.62 - inline const std::vector<byte>& ec_params() const + inline const std::vector<uint8_t>& ec_params() const { return m_ec_params; } /// @return the DER-encoding of the ec public point according to ANSI X9.62 - inline const std::vector<byte>& ec_point() const + inline const std::vector<uint8_t>& ec_point() const { return m_ec_point; } private: - const std::vector<byte> m_ec_params; - const std::vector<byte> m_ec_point; + const std::vector<uint8_t> m_ec_params; + const std::vector<uint8_t> m_ec_point; }; /// Represents a PKCS#11 EC public key @@ -108,10 +108,10 @@ class BOTAN_DLL EC_PrivateKeyImportProperties final : public PrivateKeyPropertie * @param ec_params DER-encoding of an ANSI X9.62 Parameters value * @param value ANSI X9.62 private value d */ - EC_PrivateKeyImportProperties(const std::vector<byte>& ec_params, const BigInt& value); + EC_PrivateKeyImportProperties(const std::vector<uint8_t>& ec_params, const BigInt& value); /// @return the DER-encoding of the ec parameters according to ANSI X9.62 - inline const std::vector<byte>& ec_params() const + inline const std::vector<uint8_t>& ec_params() const { return m_ec_params; } @@ -123,7 +123,7 @@ class BOTAN_DLL EC_PrivateKeyImportProperties final : public PrivateKeyPropertie } private: - const std::vector<byte> m_ec_params; + const std::vector<uint8_t> m_ec_params; const BigInt m_value; }; @@ -157,7 +157,7 @@ class BOTAN_DLL PKCS11_EC_PrivateKey : public virtual Private_Key, * @param props the attributes of the private key * @note no persistent public key object will be created */ - PKCS11_EC_PrivateKey(Session& session, const std::vector<byte>& ec_params, + PKCS11_EC_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params, const EC_PrivateKeyGenerationProperties& props); /// @returns the domain of the EC private key @@ -201,7 +201,7 @@ class BOTAN_DLL PKCS11_EC_PrivateKey : public virtual Private_Key, // Private_Key methods - std::vector<byte> public_key_bits() const override; + std::vector<uint8_t> public_key_bits() const override; std::size_t key_length() const override; diff --git a/src/lib/prov/pkcs11/p11_ecdh.cpp b/src/lib/prov/pkcs11/p11_ecdh.cpp index 50aa964d5..088b93894 100644 --- a/src/lib/prov/pkcs11/p11_ecdh.cpp +++ b/src/lib/prov/pkcs11/p11_ecdh.cpp @@ -33,7 +33,7 @@ ECDH_PrivateKey PKCS11_ECDH_PrivateKey::export_key() const return ECDH_PrivateKey(rng, domain(), BigInt::decode(priv_key)); } -secure_vector<byte> PKCS11_ECDH_PrivateKey::private_key_bits() const +secure_vector<uint8_t> PKCS11_ECDH_PrivateKey::private_key_bits() const { return export_key().private_key_bits(); } @@ -49,10 +49,10 @@ class PKCS11_ECDH_KA_Operation : public PK_Ops::Key_Agreement /// The encoding in V2.20 was not specified and resulted in different implementations choosing different encodings. /// Applications relying only on a V2.20 encoding (e.g. the DER variant) other than the one specified now (raw) may not work with all V2.30 compliant tokens. - secure_vector<byte> agree(size_t key_len, const byte other_key[], size_t other_key_len, const byte salt[], + secure_vector<uint8_t> agree(size_t key_len, const uint8_t other_key[], size_t other_key_len, const uint8_t salt[], size_t salt_len) override { - std::vector<byte> der_encoded_other_key; + std::vector<uint8_t> der_encoded_other_key; if(m_key.point_encoding() == PublicPointEncoding::Der) { der_encoded_other_key = DER_Encoder().encode(other_key, other_key_len, OCTET_STRING).get_contents_unlocked(); @@ -79,7 +79,7 @@ class PKCS11_ECDH_KA_Operation : public PK_Ops::Key_Agreement attributes.count(), &secret_handle); Object secret_object(m_key.session(), secret_handle); - secure_vector<byte> secret = secret_object.get_attribute_value(AttributeType::Value); + secure_vector<uint8_t> secret = secret_object.get_attribute_value(AttributeType::Value); if(secret.size() < key_len) { throw PKCS11_Error("ECDH key derivation secret length is too short"); diff --git a/src/lib/prov/pkcs11/p11_ecdh.h b/src/lib/prov/pkcs11/p11_ecdh.h index 7fc21ad46..c8e4017ba 100644 --- a/src/lib/prov/pkcs11/p11_ecdh.h +++ b/src/lib/prov/pkcs11/p11_ecdh.h @@ -83,7 +83,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK * @param props the attributes of the private key * @note no persistent public key object will be created */ - PKCS11_ECDH_PrivateKey(Session& session, const std::vector<byte>& ec_params, + PKCS11_ECDH_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params, const EC_PrivateKeyGenerationProperties& props) : PKCS11_EC_PrivateKey(session, ec_params, props) {} @@ -93,7 +93,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK return "ECDH"; } - inline std::vector<byte> public_value() const override + inline std::vector<uint8_t> public_value() const override { return unlock(EC2OSP(public_point(), PointGFp::UNCOMPRESSED)); } @@ -101,7 +101,7 @@ class BOTAN_DLL PKCS11_ECDH_PrivateKey final : public virtual PKCS11_EC_PrivateK /// @return the exported ECDH private key ECDH_PrivateKey export_key() const; - secure_vector<byte> private_key_bits() const override; + secure_vector<uint8_t> private_key_bits() const override; std::unique_ptr<PK_Ops::Key_Agreement> create_key_agreement_op(RandomNumberGenerator& rng, diff --git a/src/lib/prov/pkcs11/p11_ecdsa.cpp b/src/lib/prov/pkcs11/p11_ecdsa.cpp index cbdd4d007..5be66caaf 100644 --- a/src/lib/prov/pkcs11/p11_ecdsa.cpp +++ b/src/lib/prov/pkcs11/p11_ecdsa.cpp @@ -47,7 +47,7 @@ ECDSA_PrivateKey PKCS11_ECDSA_PrivateKey::export_key() const return ECDSA_PrivateKey(rng, domain(), BigInt::decode(priv_key)); } -secure_vector<byte> PKCS11_ECDSA_PrivateKey::private_key_bits() const +secure_vector<uint8_t> PKCS11_ECDSA_PrivateKey::private_key_bits() const { return export_key().private_key_bits(); } @@ -61,14 +61,14 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature : PK_Ops::Signature(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa)) {} - void update(const byte msg[], size_t msg_len) override + void update(const uint8_t msg[], size_t msg_len) override { if(!m_initialized) { // first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed m_key.module()->C_SignInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); m_initialized = true; - m_first_message = secure_vector<byte>(msg, msg + msg_len); + m_first_message = secure_vector<uint8_t>(msg, msg + msg_len); return; } @@ -82,9 +82,9 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature m_key.module()->C_SignUpdate(m_key.session().handle(), const_cast<Byte*>(msg), msg_len); } - secure_vector<byte> sign(RandomNumberGenerator&) override + secure_vector<uint8_t> sign(RandomNumberGenerator&) override { - secure_vector<byte> signature; + secure_vector<uint8_t> signature; if(!m_first_message.empty()) { // single call to update: perform single-part operation @@ -104,7 +104,7 @@ class PKCS11_ECDSA_Signature_Operation : public PK_Ops::Signature const PKCS11_EC_PrivateKey& m_key; const BigInt& m_order; MechanismWrapper m_mechanism; - secure_vector<byte> m_first_message; + secure_vector<uint8_t> m_first_message; bool m_initialized = false; }; @@ -116,14 +116,14 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification : PK_Ops::Verification(), m_key(key), m_order(key.domain().get_order()), m_mechanism(MechanismWrapper::create_ecdsa_mechanism(emsa)) {} - void update(const byte msg[], size_t msg_len) override + void update(const uint8_t msg[], size_t msg_len) override { if(!m_initialized) { // first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed m_key.module()->C_VerifyInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); m_initialized = true; - m_first_message = secure_vector<byte>(msg, msg + msg_len); + m_first_message = secure_vector<uint8_t>(msg, msg + msg_len); return; } @@ -137,7 +137,7 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification m_key.module()->C_VerifyUpdate(m_key.session().handle(), const_cast<Byte*>(msg), msg_len); } - bool is_valid_signature(const byte sig[], size_t sig_len) override + bool is_valid_signature(const uint8_t sig[], size_t sig_len) override { ReturnValue return_value = ReturnValue::SignatureInvalid; if(!m_first_message.empty()) @@ -164,7 +164,7 @@ class PKCS11_ECDSA_Verification_Operation : public PK_Ops::Verification const PKCS11_EC_PublicKey& m_key; const BigInt& m_order; MechanismWrapper m_mechanism; - secure_vector<byte> m_first_message; + secure_vector<uint8_t> m_first_message; bool m_initialized = false; }; diff --git a/src/lib/prov/pkcs11/p11_ecdsa.h b/src/lib/prov/pkcs11/p11_ecdsa.h index 73ee900db..c1ac0d557 100644 --- a/src/lib/prov/pkcs11/p11_ecdsa.h +++ b/src/lib/prov/pkcs11/p11_ecdsa.h @@ -85,7 +85,7 @@ class BOTAN_DLL PKCS11_ECDSA_PrivateKey final : public PKCS11_EC_PrivateKey * @param props the attributes of the private key * @note no persistent public key object will be created */ - PKCS11_ECDSA_PrivateKey(Session& session, const std::vector<byte>& ec_params, + PKCS11_ECDSA_PrivateKey(Session& session, const std::vector<uint8_t>& ec_params, const EC_PrivateKeyGenerationProperties& props) : PKCS11_EC_PrivateKey(session, ec_params, props) {} @@ -98,7 +98,7 @@ class BOTAN_DLL PKCS11_ECDSA_PrivateKey final : public PKCS11_EC_PrivateKey /// @return the exported ECDSA private key ECDSA_PrivateKey export_key() const; - secure_vector<byte> private_key_bits() const override; + secure_vector<uint8_t> private_key_bits() const override; bool check_key(RandomNumberGenerator&, bool) const override; diff --git a/src/lib/prov/pkcs11/p11_mechanism.h b/src/lib/prov/pkcs11/p11_mechanism.h index dde5e5b07..be48c9a14 100644 --- a/src/lib/prov/pkcs11/p11_mechanism.h +++ b/src/lib/prov/pkcs11/p11_mechanism.h @@ -63,9 +63,9 @@ class MechanismWrapper final * @param salt the salt * @param salt_len size of the salt in bytes */ - inline void set_ecdh_salt(const byte salt[], size_t salt_len) + inline void set_ecdh_salt(const uint8_t salt[], size_t salt_len) { - m_parameters->ecdh_params.pSharedData = const_cast<byte*>(salt); + m_parameters->ecdh_params.pSharedData = const_cast<uint8_t*>(salt); m_parameters->ecdh_params.ulSharedDataLen = salt_len; } @@ -74,9 +74,9 @@ class MechanismWrapper final * @param other_key key of the other party * @param other_key_len size of the key of the other party in bytes */ - inline void set_ecdh_other_key(const byte other_key[], size_t other_key_len) + inline void set_ecdh_other_key(const uint8_t other_key[], size_t other_key_len) { - m_parameters->ecdh_params.pPublicData = const_cast<byte*>(other_key); + m_parameters->ecdh_params.pPublicData = const_cast<uint8_t*>(other_key); m_parameters->ecdh_params.ulPublicDataLen = other_key_len; } diff --git a/src/lib/prov/pkcs11/p11_object.cpp b/src/lib/prov/pkcs11/p11_object.cpp index ef7477284..872fdf8b7 100644 --- a/src/lib/prov/pkcs11/p11_object.cpp +++ b/src/lib/prov/pkcs11/p11_object.cpp @@ -22,28 +22,28 @@ AttributeContainer::AttributeContainer(ObjectClass object_class) void AttributeContainer::add_class(ObjectClass object_class) { m_numerics.push_back(static_cast< uint64_t >(object_class)); - add_attribute(AttributeType::Class, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(ObjectClass)); + add_attribute(AttributeType::Class, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(ObjectClass)); } void AttributeContainer::add_string(AttributeType attribute, const std::string& value) { m_strings.push_back(value); - add_attribute(attribute, reinterpret_cast< const byte* >(m_strings.back().data()), value.size()); + add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_strings.back().data()), value.size()); } -void AttributeContainer::add_binary(AttributeType attribute, const byte* value, size_t length) +void AttributeContainer::add_binary(AttributeType attribute, const uint8_t* value, size_t length) { - m_vectors.push_back(secure_vector<byte>(value, value + length)); - add_attribute(attribute, reinterpret_cast< const byte* >(m_vectors.back().data()), length); + m_vectors.push_back(secure_vector<uint8_t>(value, value + length)); + add_attribute(attribute, reinterpret_cast< const uint8_t* >(m_vectors.back().data()), length); } void AttributeContainer::add_bool(AttributeType attribute, bool value) { m_numerics.push_back(value ? True : False); - add_attribute(attribute, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(Bbool)); + add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(Bbool)); } -void AttributeContainer::add_attribute(AttributeType attribute, const byte* value, uint32_t size) +void AttributeContainer::add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size) { bool exists = false; // check if the attribute has been added already @@ -63,12 +63,12 @@ void AttributeContainer::add_attribute(AttributeType attribute, const byte* valu }), m_numerics.end()); m_vectors.erase(std::remove_if(m_vectors.begin(), - m_vectors.end(), [ &existing_attribute ](const secure_vector<byte>& data) + m_vectors.end(), [ &existing_attribute ](const secure_vector<uint8_t>& data) { return data.data() == existing_attribute.pValue; }), m_vectors.end()); - existing_attribute.pValue = const_cast< byte* >(value); + existing_attribute.pValue = const_cast< uint8_t* >(value); existing_attribute.ulValueLen = size; exists = true; break; @@ -77,7 +77,7 @@ void AttributeContainer::add_attribute(AttributeType attribute, const byte* valu if(!exists) { - m_attributes.push_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(attribute), const_cast< byte* >(value), size }); + m_attributes.push_back(Attribute{ static_cast< CK_ATTRIBUTE_TYPE >(attribute), const_cast< uint8_t* >(value), size }); } } @@ -188,16 +188,16 @@ Object::Object(Session& session, const ObjectProperties& obj_props) m_session.get().module()->C_CreateObject(m_session.get().handle(), obj_props.data(), obj_props.count(), &m_handle); } -secure_vector<byte> Object::get_attribute_value(AttributeType attribute) const +secure_vector<uint8_t> Object::get_attribute_value(AttributeType attribute) const { - std::map<AttributeType, secure_vector<byte>> attribute_map = { { attribute, secure_vector<byte>() } }; + std::map<AttributeType, secure_vector<uint8_t>> attribute_map = { { attribute, secure_vector<uint8_t>() } }; module()->C_GetAttributeValue(m_session.get().handle(), m_handle, attribute_map); return attribute_map.at(attribute); } -void Object::set_attribute_value(AttributeType attribute, const secure_vector<byte>& value) const +void Object::set_attribute_value(AttributeType attribute, const secure_vector<uint8_t>& value) const { - std::map<AttributeType, secure_vector<byte>> attribute_map = { { attribute, value } }; + std::map<AttributeType, secure_vector<uint8_t>> attribute_map = { { attribute, value } }; module()->C_SetAttributeValue(m_session.get().handle(), m_handle, attribute_map); } diff --git a/src/lib/prov/pkcs11/p11_object.h b/src/lib/prov/pkcs11/p11_object.h index cae1969a2..e7ab05f0d 100644 --- a/src/lib/prov/pkcs11/p11_object.h +++ b/src/lib/prov/pkcs11/p11_object.h @@ -83,7 +83,7 @@ class BOTAN_DLL AttributeContainer * @param value binary attribute value to add * @param length size of the binary attribute value in bytes */ - void add_binary(AttributeType attribute, const byte* value, size_t length); + void add_binary(AttributeType attribute, const uint8_t* value, size_t length); /** * Add a binary attribute (e.g. CKA_ID / AttributeType::Id). @@ -91,7 +91,7 @@ class BOTAN_DLL AttributeContainer * @param binary binary attribute value to add */ template<typename TAlloc> - void add_binary(AttributeType attribute, const std::vector<byte, TAlloc>& binary) + void add_binary(AttributeType attribute, const std::vector<uint8_t, TAlloc>& binary) { add_binary(attribute, binary.data(), binary.size()); } @@ -113,18 +113,18 @@ class BOTAN_DLL AttributeContainer { static_assert(std::is_integral<T>::value, "Numeric value required."); m_numerics.push_back(static_cast< uint64_t >(value)); - add_attribute(attribute, reinterpret_cast< byte* >(&m_numerics.back()), sizeof(T)); + add_attribute(attribute, reinterpret_cast< uint8_t* >(&m_numerics.back()), sizeof(T)); } protected: /// Add an attribute with the given value and size to the attribute collection `m_attributes` - void add_attribute(AttributeType attribute, const byte* value, uint32_t size); + void add_attribute(AttributeType attribute, const uint8_t* value, uint32_t size); private: std::vector<Attribute> m_attributes; std::list<uint64_t> m_numerics; std::list<std::string> m_strings; - std::list<secure_vector<byte>> m_vectors; + std::list<secure_vector<uint8_t>> m_vectors; }; /// Manages calls to C_FindObjects* functions (C_FindObjectsInit -> C_FindObjects -> C_FindObjectsFinal) @@ -249,13 +249,13 @@ class BOTAN_DLL DataObjectProperties : public StorageObjectProperties } /// @param object_id DER-encoding of the object identifier indicating the data object type - inline void set_object_id(const std::vector<byte>& object_id) + inline void set_object_id(const std::vector<uint8_t>& object_id) { add_binary(AttributeType::ObjectId, object_id); } /// @param value value of the object - inline void set_value(const secure_vector<byte>& value) + inline void set_value(const secure_vector<uint8_t>& value) { add_binary(AttributeType::Value, value); } @@ -284,7 +284,7 @@ class BOTAN_DLL CertificateProperties : public StorageObjectProperties * @param checksum the value of this attribute is derived from the certificate by taking the * first three bytes of the SHA - 1 hash of the certificate object's `CKA_VALUE` attribute */ - inline void set_check_value(const std::vector<byte>& checksum) + inline void set_check_value(const std::vector<uint8_t>& checksum) { add_binary(AttributeType::CheckValue, checksum); } @@ -292,17 +292,17 @@ class BOTAN_DLL CertificateProperties : public StorageObjectProperties /// @param date start date for the certificate inline void set_start_date(Date date) { - add_binary(AttributeType::StartDate, reinterpret_cast<byte*>(&date), sizeof(Date)); + add_binary(AttributeType::StartDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date)); } /// @param date end date for the certificate inline void set_end_date(Date date) { - add_binary(AttributeType::EndDate, reinterpret_cast<byte*>(&date), sizeof(Date)); + add_binary(AttributeType::EndDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date)); } /// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for the public key contained in this certificate - inline void set_public_key_info(const std::vector<byte>& pubkey_info) + inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info) { add_binary(AttributeType::PublicKeyInfo, pubkey_info); } @@ -328,7 +328,7 @@ class BOTAN_DLL KeyProperties : public StorageObjectProperties KeyProperties(ObjectClass object_class, KeyType key_type); /// @param id key identifier for key - inline void set_id(const std::vector<byte>& id) + inline void set_id(const std::vector<uint8_t>& id) { add_binary(AttributeType::Id, id); } @@ -336,13 +336,13 @@ class BOTAN_DLL KeyProperties : public StorageObjectProperties /// @param date start date for the key inline void set_start_date(Date date) { - add_binary(AttributeType::StartDate, reinterpret_cast<byte*>(&date), sizeof(Date)); + add_binary(AttributeType::StartDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date)); } /// @param date end date for the key inline void set_end_date(Date date) { - add_binary(AttributeType::EndDate, reinterpret_cast<byte*>(&date), sizeof(Date)); + add_binary(AttributeType::EndDate, reinterpret_cast<uint8_t*>(&date), sizeof(Date)); } /// @param value true if key supports key derivation (i.e., if other keys can be derived from this one) @@ -378,7 +378,7 @@ class BOTAN_DLL PublicKeyProperties : public KeyProperties PublicKeyProperties(KeyType key_type); /// @param subject DER-encoding of the key subject name - inline void set_subject(const std::vector<byte>& subject) + inline void set_subject(const std::vector<uint8_t>& subject) { add_binary(AttributeType::Subject, subject); } @@ -428,7 +428,7 @@ class BOTAN_DLL PublicKeyProperties : public KeyProperties } /// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for this public key - inline void set_public_key_info(const std::vector<byte>& pubkey_info) + inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info) { add_binary(AttributeType::PublicKeyInfo, pubkey_info); } @@ -442,7 +442,7 @@ class BOTAN_DLL PrivateKeyProperties : public KeyProperties PrivateKeyProperties(KeyType key_type); /// @param subject DER-encoding of the key subject name - inline void set_subject(const std::vector<byte>& subject) + inline void set_subject(const std::vector<uint8_t>& subject) { add_binary(AttributeType::Subject, subject); } @@ -507,7 +507,7 @@ class BOTAN_DLL PrivateKeyProperties : public KeyProperties } /// @param pubkey_info DER-encoding of the SubjectPublicKeyInfo for this public key - inline void set_public_key_info(const std::vector<byte>& pubkey_info) + inline void set_public_key_info(const std::vector<uint8_t>& pubkey_info) { add_binary(AttributeType::PublicKeyInfo, pubkey_info); } @@ -590,7 +590,7 @@ class BOTAN_DLL SecretKeyProperties : public KeyProperties } /// @param checksum the key check value of this key - inline void set_check_value(const std::vector<byte>& checksum) + inline void set_check_value(const std::vector<uint8_t>& checksum) { add_binary(AttributeType::CheckValue, checksum); } @@ -668,21 +668,21 @@ class BOTAN_DLL Object /// Searches for all objects of the given type using the id (`CKA_ID`) template<typename T> - static std::vector<T> search(Session& session, const std::vector<byte>& id); + static std::vector<T> search(Session& session, const std::vector<uint8_t>& id); /// Searches for all objects of the given type using the label (`CKA_LABEL`) and id (`CKA_ID`) template<typename T> - static std::vector<T> search(Session& session, const std::string& label, const std::vector<byte>& id); + static std::vector<T> search(Session& session, const std::string& label, const std::vector<uint8_t>& id); /// Searches for all objects of the given type template<typename T> static std::vector<T> search(Session& session); /// @returns the value of the given attribute (using `C_GetAttributeValue`) - secure_vector<byte> get_attribute_value(AttributeType attribute) const; + secure_vector<uint8_t> get_attribute_value(AttributeType attribute) const; /// Sets the given value for the attribute (using `C_SetAttributeValue`) - void set_attribute_value(AttributeType attribute, const secure_vector<byte>& value) const; + void set_attribute_value(AttributeType attribute, const secure_vector<uint8_t>& value) const; /// Destroys the object void destroy() const; @@ -742,7 +742,7 @@ std::vector<T> Object::search(Session& session, const std::string& label) } template<typename T> -std::vector<T> Object::search(Session& session, const std::vector<byte>& id) +std::vector<T> Object::search(Session& session, const std::vector<uint8_t>& id) { AttributeContainer search_template(T::Class); search_template.add_binary(AttributeType::Id, id); @@ -750,7 +750,7 @@ std::vector<T> Object::search(Session& session, const std::vector<byte>& id) } template<typename T> -std::vector<T> Object::search(Session& session, const std::string& label, const std::vector<byte>& id) +std::vector<T> Object::search(Session& session, const std::string& label, const std::vector<uint8_t>& id) { AttributeContainer search_template(T::Class); search_template.add_string(AttributeType::Label, label); diff --git a/src/lib/prov/pkcs11/p11_randomgenerator.cpp b/src/lib/prov/pkcs11/p11_randomgenerator.cpp index eaf9933c6..957a33cae 100644 --- a/src/lib/prov/pkcs11/p11_randomgenerator.cpp +++ b/src/lib/prov/pkcs11/p11_randomgenerator.cpp @@ -16,14 +16,14 @@ PKCS11_RNG::PKCS11_RNG(Session& session) : m_session(session) {} -void PKCS11_RNG::randomize(Botan::byte output[], std::size_t length) +void PKCS11_RNG::randomize(uint8_t output[], std::size_t length) { module()->C_GenerateRandom(m_session.get().handle(), output, length); } -void PKCS11_RNG::add_entropy(const Botan::byte in[], std::size_t length) +void PKCS11_RNG::add_entropy(const uint8_t in[], std::size_t length) { - module()->C_SeedRandom(m_session.get().handle(), const_cast<Botan::byte*>(in), length); + module()->C_SeedRandom(m_session.get().handle(), const_cast<uint8_t*>(in), length); } } diff --git a/src/lib/prov/pkcs11/p11_randomgenerator.h b/src/lib/prov/pkcs11/p11_randomgenerator.h index a291c89f3..6a29f8040 100644 --- a/src/lib/prov/pkcs11/p11_randomgenerator.h +++ b/src/lib/prov/pkcs11/p11_randomgenerator.h @@ -55,10 +55,10 @@ class BOTAN_DLL PKCS11_RNG final : public Hardware_RNG } /// Calls `C_GenerateRandom` to generate random data - void randomize(Botan::byte output[], std::size_t length) override; + void randomize(uint8_t output[], std::size_t length) override; /// Calls `C_SeedRandom` to add entropy to the random generation function of the token/middleware - void add_entropy(const Botan::byte in[], std::size_t length) override; + void add_entropy(const uint8_t in[], std::size_t length) override; private: const std::reference_wrapper<Session> m_session; diff --git a/src/lib/prov/pkcs11/p11_rsa.cpp b/src/lib/prov/pkcs11/p11_rsa.cpp index 1edbde83b..3bb7b7534 100644 --- a/src/lib/prov/pkcs11/p11_rsa.cpp +++ b/src/lib/prov/pkcs11/p11_rsa.cpp @@ -101,7 +101,7 @@ RSA_PrivateKey PKCS11_RSA_PrivateKey::export_key() const , BigInt::decode(n)); } -secure_vector<byte> PKCS11_RSA_PrivateKey::private_key_bits() const +secure_vector<uint8_t> PKCS11_RSA_PrivateKey::private_key_bits() const { return export_key().private_key_bits(); } @@ -127,12 +127,12 @@ class PKCS11_RSA_Decryption_Operation final : public PK_Ops::Decryption m_bits = m_key.get_n().bits() - 1; } - secure_vector<byte> decrypt(byte& valid_mask, const byte ciphertext[], size_t ciphertext_len) override + secure_vector<uint8_t> decrypt(uint8_t& valid_mask, const uint8_t ciphertext[], size_t ciphertext_len) override { valid_mask = 0; m_key.module()->C_DecryptInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); - std::vector<byte> encrypted_data(ciphertext, ciphertext + ciphertext_len); + std::vector<uint8_t> encrypted_data(ciphertext, ciphertext + ciphertext_len); // blind for RSA/RAW decryption if(! m_mechanism.padding_size()) @@ -140,7 +140,7 @@ class PKCS11_RSA_Decryption_Operation final : public PK_Ops::Decryption encrypted_data = BigInt::encode(m_blinder.blind(BigInt::decode(encrypted_data))); } - secure_vector<byte> decrypted_data; + secure_vector<uint8_t> decrypted_data; m_key.module()->C_Decrypt(m_key.session().handle(), encrypted_data, decrypted_data); // Unblind for RSA/RAW decryption @@ -178,12 +178,12 @@ class PKCS11_RSA_Encryption_Operation : public PK_Ops::Encryption return m_bits; } - secure_vector<byte> encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator&) override + secure_vector<uint8_t> encrypt(const uint8_t msg[], size_t msg_len, RandomNumberGenerator&) override { m_key.module()->C_EncryptInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); - secure_vector<byte> encrytped_data; - m_key.module()->C_Encrypt(m_key.session().handle(), secure_vector<byte>(msg, msg + msg_len), encrytped_data); + secure_vector<uint8_t> encrytped_data; + m_key.module()->C_Encrypt(m_key.session().handle(), secure_vector<uint8_t>(msg, msg + msg_len), encrytped_data); return encrytped_data; } @@ -202,14 +202,14 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature : m_key(key), m_mechanism(MechanismWrapper::create_rsa_sign_mechanism(padding)) {} - void update(const byte msg[], size_t msg_len) override + void update(const uint8_t msg[], size_t msg_len) override { if(!m_initialized) { // first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed m_key.module()->C_SignInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); m_initialized = true; - m_first_message = secure_vector<byte>(msg, msg + msg_len); + m_first_message = secure_vector<uint8_t>(msg, msg + msg_len); return; } @@ -223,9 +223,9 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature m_key.module()->C_SignUpdate(m_key.session().handle(), const_cast< Byte* >(msg), msg_len); } - secure_vector<byte> sign(RandomNumberGenerator&) override + secure_vector<uint8_t> sign(RandomNumberGenerator&) override { - secure_vector<byte> signature; + secure_vector<uint8_t> signature; if(!m_first_message.empty()) { // single call to update: perform single-part operation @@ -244,7 +244,7 @@ class PKCS11_RSA_Signature_Operation : public PK_Ops::Signature private: const PKCS11_RSA_PrivateKey& m_key; bool m_initialized = false; - secure_vector<byte> m_first_message; + secure_vector<uint8_t> m_first_message; MechanismWrapper m_mechanism; }; @@ -257,14 +257,14 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification : m_key(key), m_mechanism(MechanismWrapper::create_rsa_sign_mechanism(padding)) {} - void update(const byte msg[], size_t msg_len) override + void update(const uint8_t msg[], size_t msg_len) override { if(!m_initialized) { // first call to update: initialize and cache message because we can not determine yet whether a single- or multiple-part operation will be performed m_key.module()->C_VerifyInit(m_key.session().handle(), m_mechanism.data(), m_key.handle()); m_initialized = true; - m_first_message = secure_vector<byte>(msg, msg + msg_len); + m_first_message = secure_vector<uint8_t>(msg, msg + msg_len); return; } @@ -278,7 +278,7 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification m_key.module()->C_VerifyUpdate(m_key.session().handle(), const_cast< Byte* >(msg), msg_len); } - bool is_valid_signature(const byte sig[], size_t sig_len) override + bool is_valid_signature(const uint8_t sig[], size_t sig_len) override { ReturnValue return_value = ReturnValue::SignatureInvalid; if(!m_first_message.empty()) @@ -304,7 +304,7 @@ class PKCS11_RSA_Verification_Operation : public PK_Ops::Verification private: const PKCS11_RSA_PublicKey& m_key; bool m_initialized = false; - secure_vector<byte> m_first_message; + secure_vector<uint8_t> m_first_message; MechanismWrapper m_mechanism; }; diff --git a/src/lib/prov/pkcs11/p11_rsa.h b/src/lib/prov/pkcs11/p11_rsa.h index 13b9d9dc1..1a6fd4890 100644 --- a/src/lib/prov/pkcs11/p11_rsa.h +++ b/src/lib/prov/pkcs11/p11_rsa.h @@ -200,7 +200,7 @@ class BOTAN_DLL PKCS11_RSA_PrivateKey final : public Private_Key, /// @return the exported RSA private key RSA_PrivateKey export_key() const; - secure_vector<byte> private_key_bits() const override; + secure_vector<uint8_t> private_key_bits() const override; std::unique_ptr<PK_Ops::Decryption> create_decryption_op(RandomNumberGenerator& rng, diff --git a/src/lib/prov/pkcs11/p11_x509.cpp b/src/lib/prov/pkcs11/p11_x509.cpp index 76b120368..5c6accdf0 100644 --- a/src/lib/prov/pkcs11/p11_x509.cpp +++ b/src/lib/prov/pkcs11/p11_x509.cpp @@ -13,7 +13,7 @@ namespace Botan { namespace PKCS11 { -X509_CertificateProperties::X509_CertificateProperties(const std::vector<byte>& subject, const std::vector<byte>& value) +X509_CertificateProperties::X509_CertificateProperties(const std::vector<uint8_t>& subject, const std::vector<uint8_t>& value) : CertificateProperties(CertificateType::X509), m_subject(subject), m_value(value) { add_binary(AttributeType::Subject, m_subject); diff --git a/src/lib/prov/pkcs11/p11_x509.h b/src/lib/prov/pkcs11/p11_x509.h index f0e025ff4..db83286cc 100644 --- a/src/lib/prov/pkcs11/p11_x509.h +++ b/src/lib/prov/pkcs11/p11_x509.h @@ -31,34 +31,34 @@ class BOTAN_DLL X509_CertificateProperties final : public CertificateProperties * @param subject DER-encoding of the certificate subject name * @param value BER-encoding of the certificate */ - X509_CertificateProperties(const std::vector<byte>& subject, const std::vector<byte>& value); + X509_CertificateProperties(const std::vector<uint8_t>& subject, const std::vector<uint8_t>& value); /// @param id key identifier for public/private key pair - inline void set_id(const std::vector<byte>& id) + inline void set_id(const std::vector<uint8_t>& id) { add_binary(AttributeType::Id, id); } /// @param issuer DER-encoding of the certificate issuer name - inline void set_issuer(const std::vector<byte>& issuer) + inline void set_issuer(const std::vector<uint8_t>& issuer) { add_binary(AttributeType::Issuer, issuer); } /// @param serial DER-encoding of the certificate serial number - inline void set_serial(const std::vector<byte>& serial) + inline void set_serial(const std::vector<uint8_t>& serial) { add_binary(AttributeType::SerialNumber, serial); } /// @param hash hash value of the subject public key - inline void set_subject_pubkey_hash(const std::vector<byte>& hash) + inline void set_subject_pubkey_hash(const std::vector<uint8_t>& hash) { add_binary(AttributeType::HashOfSubjectPublicKey, hash); } /// @param hash hash value of the issuer public key - inline void set_issuer_pubkey_hash(const std::vector<byte>& hash) + inline void set_issuer_pubkey_hash(const std::vector<uint8_t>& hash) { add_binary(AttributeType::HashOfIssuerPublicKey, hash); } @@ -70,20 +70,20 @@ class BOTAN_DLL X509_CertificateProperties final : public CertificateProperties } /// @return the subject - inline const std::vector<byte>& subject() const + inline const std::vector<uint8_t>& subject() const { return m_subject; } /// @return the BER-encoding of the certificate - inline const std::vector<byte>& value() const + inline const std::vector<uint8_t>& value() const { return m_value; } private: - const std::vector<byte> m_subject; - const std::vector<byte> m_value; + const std::vector<uint8_t> m_subject; + const std::vector<uint8_t> m_value; }; /// Represents a PKCS#11 X509 certificate |