Botan 3.14.1
Crypto and TLS for C&
Botan::TLS::Signature_Scheme Class Referencefinal

#include <tls_signature_scheme.h>

Public Types

enum  Code : uint16_t {
  NONE = 0x0000 , RSA_PKCS1_SHA1 = 0x0201 , RSA_PKCS1_SHA256 = 0x0401 , RSA_PKCS1_SHA384 = 0x0501 ,
  RSA_PKCS1_SHA512 = 0x0601 , ECDSA_SECP256R1_TLS13_SHA256 = 0x0403 , ECDSA_SECP384R1_TLS13_SHA384 = 0x0503 , ECDSA_SECP521R1_TLS13_SHA512 = 0x0603 ,
  ECDSA_SHA1 = 0x0203 , ECDSA_SHA256 = ECDSA_SECP256R1_TLS13_SHA256 , ECDSA_SHA384 = ECDSA_SECP384R1_TLS13_SHA384 , ECDSA_SHA512 = ECDSA_SECP521R1_TLS13_SHA512 ,
  RSA_PSS_SHA256 = 0x0804 , RSA_PSS_SHA384 = 0x0805 , RSA_PSS_SHA512 = 0x0806 , ECDSA_BRAINPOOL256R1_TLS13_SHA256 = 0x081A ,
  ECDSA_BRAINPOOL384R1_TLS13_SHA384 = 0x081B , ECDSA_BRAINPOOL512R1_TLS13_SHA512 = 0x081C , EDDSA_25519 = 0x0807 , EDDSA_448 = 0x0808
}

Public Member Functions

AlgorithmIdentifier algorithm_identifier () const
std::string algorithm_name () const
std::optional< Signature_Format > format () const noexcept
std::string hash_function_name () const
bool is_available () const noexcept
bool is_compatible_with (const Protocol_Version &protocol_version) const noexcept
bool is_set () const noexcept
bool is_suitable_for (const Private_Key &private_key) const
AlgorithmIdentifier key_algorithm_identifier () const
bool operator!= (const Signature_Scheme &rhs) const
bool operator== (const Signature_Scheme &rhs) const
std::string padding_string () const
 Signature_Scheme ()
 Signature_Scheme (Signature_Scheme::Code wire_code)
 Signature_Scheme (uint16_t wire_code)
std::string to_string () const
Signature_Scheme::Code wire_code () const noexcept

Static Public Member Functions

static const std::vector< Signature_Scheme > & all_available_schemes ()
static Signature_Scheme from_string (std::string_view str)

Detailed Description

Definition at line 29 of file tls_signature_scheme.h.

Member Enumeration Documentation

◆ Code

Matches with wire encoding

Note that this is intentionally left as a bare enum. It emulates the Botan 2 API where Signature_Scheme was an enum class with associated free-standing functions. Leaving it as a bare enum resembles the legacy user-facing API.

Enumerator
NONE 
RSA_PKCS1_SHA1 
RSA_PKCS1_SHA256 
RSA_PKCS1_SHA384 
RSA_PKCS1_SHA512 
ECDSA_SECP256R1_TLS13_SHA256 
ECDSA_SECP384R1_TLS13_SHA384 
ECDSA_SECP521R1_TLS13_SHA512 
ECDSA_SHA1 
ECDSA_SHA256 
ECDSA_SHA384 
ECDSA_SHA512 
RSA_PSS_SHA256 
RSA_PSS_SHA384 
RSA_PSS_SHA512 
ECDSA_BRAINPOOL256R1_TLS13_SHA256 
ECDSA_BRAINPOOL384R1_TLS13_SHA384 
ECDSA_BRAINPOOL512R1_TLS13_SHA512 
EDDSA_25519 
EDDSA_448 

Definition at line 38 of file tls_signature_scheme.h.

38 : uint16_t /* NOLINT(*-use-enum-class) */ {
39 NONE = 0x0000,
40
41 RSA_PKCS1_SHA1 = 0x0201, // not implemented
42 RSA_PKCS1_SHA256 = 0x0401,
43 RSA_PKCS1_SHA384 = 0x0501,
44 RSA_PKCS1_SHA512 = 0x0601,
45
46 // RFC 9846 4.3.3
47 // ECDSA algorithms: Indicates a signature algorithm using ECDSA,
48 // the corresponding curve as defined in NIST SP 800-186.
49 //
50 // In TLS 1.3 these code points specifically refer to the NIST curves
51 // P-256, P-384, and P-521. In contrast TLS 1.2 uses these code points
52 // for ECDSA on any curve paired with the specified hash function.
56
57 // RFC 5246 7.4.1.4.1
58 // The client uses the "signature_algorithms" extension to indicate
59 // to the server which signature/hash algorithm pairs may be used in
60 // digital signatures.
61 //
62 // In TLS 1.2 the signature_algorithms extension contains pairs of hash
63 // and signature algorithms. For ECDSA these code points are not bound
64 // to a specific curve in contrast to TLS 1.3, where these code points
65 // imply the usage of NIST's P-256, P-384, and P-521 curves.
66 ECDSA_SHA1 = 0x0203, // not implemented
70
71 RSA_PSS_SHA256 = 0x0804,
72 RSA_PSS_SHA384 = 0x0805,
73 RSA_PSS_SHA512 = 0x0806,
74
75 // RFC 8734
79
80 EDDSA_25519 = 0x0807,
81 EDDSA_448 = 0x0808,
82 };

Constructor & Destructor Documentation

◆ Signature_Scheme() [1/3]

Botan::TLS::Signature_Scheme::Signature_Scheme ( )

Construct an uninitialized / invalid scheme

Definition at line 122 of file tls_signature_scheme.cpp.

122: m_code(NONE) {}

References NONE.

Referenced by from_string(), operator!=(), operator==(), and Signature_Scheme().

◆ Signature_Scheme() [2/3]

Botan::TLS::Signature_Scheme::Signature_Scheme ( uint16_t wire_code)

◆ Signature_Scheme() [3/3]

Botan::TLS::Signature_Scheme::Signature_Scheme ( Signature_Scheme::Code wire_code)

Definition at line 126 of file tls_signature_scheme.cpp.

126: m_code(wire_code) {}

References wire_code().

Member Function Documentation

◆ algorithm_identifier()

AlgorithmIdentifier Botan::TLS::Signature_Scheme::algorithm_identifier ( ) const

Definition at line 348 of file tls_signature_scheme.cpp.

348 {
349 switch(m_code) {
350 case RSA_PKCS1_SHA1:
351 return AlgorithmIdentifier(OID::from_string("RSA/PKCS1v15(SHA-1)"), AlgorithmIdentifier::USE_NULL_PARAM);
352 case RSA_PKCS1_SHA256:
353 return AlgorithmIdentifier(OID::from_string("RSA/PKCS1v15(SHA-256)"), AlgorithmIdentifier::USE_NULL_PARAM);
354 case RSA_PKCS1_SHA384:
355 return AlgorithmIdentifier(OID::from_string("RSA/PKCS1v15(SHA-384)"), AlgorithmIdentifier::USE_NULL_PARAM);
356 case RSA_PKCS1_SHA512:
357 return AlgorithmIdentifier(OID::from_string("RSA/PKCS1v15(SHA-512)"), AlgorithmIdentifier::USE_NULL_PARAM);
358
359 case ECDSA_SHA1:
360 return AlgorithmIdentifier(OID::from_string("ECDSA/SHA-1"), AlgorithmIdentifier::USE_EMPTY_PARAM);
363 return AlgorithmIdentifier(OID::from_string("ECDSA/SHA-256"), AlgorithmIdentifier::USE_EMPTY_PARAM);
366 return AlgorithmIdentifier(OID::from_string("ECDSA/SHA-384"), AlgorithmIdentifier::USE_EMPTY_PARAM);
369 return AlgorithmIdentifier(OID::from_string("ECDSA/SHA-512"), AlgorithmIdentifier::USE_EMPTY_PARAM);
370
371 case RSA_PSS_SHA256:
372 return AlgorithmIdentifier(OID::from_string("RSA/PSS"), PSS_Params("SHA-256", 32).serialize());
373 case RSA_PSS_SHA384:
374 return AlgorithmIdentifier(OID::from_string("RSA/PSS"), PSS_Params("SHA-384", 48).serialize());
375 case RSA_PSS_SHA512:
376 return AlgorithmIdentifier(OID::from_string("RSA/PSS"), PSS_Params("SHA-512", 64).serialize());
377
378 default:
379 // Note that Ed25519 and Ed448 end up here
380 return AlgorithmIdentifier();
381 }
382}
static OID from_string(std::string_view str)
Definition asn1_oid.cpp:80

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, ECDSA_SHA1, Botan::OID::from_string(), RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, Botan::AlgorithmIdentifier::USE_EMPTY_PARAM, and Botan::AlgorithmIdentifier::USE_NULL_PARAM.

◆ algorithm_name()

std::string Botan::TLS::Signature_Scheme::algorithm_name ( ) const

◆ all_available_schemes()

const std::vector< Signature_Scheme > & Botan::TLS::Signature_Scheme::all_available_schemes ( )
static
Returns
all available signature schemes

Definition at line 23 of file tls_signature_scheme.cpp.

23 {
24 /*
25 * This is ordered in some approximate order of preference
26 */
27 static const std::vector<Signature_Scheme> all_schemes = {
28
29 // EdDSA 25519 is currently not supported as a signature scheme for certificates
30 // certificate authentication.
31 // See: https://github.com/randombit/botan/pull/2958#discussion_r851294715
32 //
33 // #if defined(BOTAN_HAS_ED25519)
34 // EDDSA_25519,
35 // #endif
36
40
41#if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_EMSA_PSSR)
45#endif
46
50
51#if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_EMSA_PKCS1)
55#endif
56 };
57
58 return all_schemes;
59}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, and RSA_PSS_SHA512.

Referenced by Botan::TLS::Policy::allowed_signature_schemes().

◆ format()

◆ from_string()

Signature_Scheme Botan::TLS::Signature_Scheme::from_string ( std::string_view str)
static
Returns
the signature scheme corresponding to the given string

Definition at line 61 of file tls_signature_scheme.cpp.

61 {
62 if(str == "RSA_PKCS1_SHA1") {
63 return RSA_PKCS1_SHA1;
64 }
65 if(str == "RSA_PKCS1_SHA256") {
66 return RSA_PKCS1_SHA256;
67 }
68 if(str == "RSA_PKCS1_SHA384") {
69 return RSA_PKCS1_SHA384;
70 }
71 if(str == "RSA_PKCS1_SHA512") {
72 return RSA_PKCS1_SHA512;
73 }
74
75 if(str == "ECDSA_SHA1") {
76 return ECDSA_SHA1;
77 }
78 if(str == "ECDSA_SHA256" || str == "ECDSA_SECP256R1_TLS13_SHA256") {
80 }
81 if(str == "ECDSA_SHA384" || str == "ECDSA_SECP384R1_TLS13_SHA384") {
83 }
84 if(str == "ECDSA_SHA512" || str == "ECDSA_SECP521R1_TLS13_SHA512") {
86 }
87
88 if(str == "RSA_PSS_SHA256") {
89 return RSA_PSS_SHA256;
90 }
91 if(str == "RSA_PSS_SHA384") {
92 return RSA_PSS_SHA384;
93 }
94 if(str == "RSA_PSS_SHA512") {
95 return RSA_PSS_SHA512;
96 }
97
98 if(str == "ECDSA_BRAINPOOL256R1_TLS13_SHA256") {
100 }
101 if(str == "ECDSA_BRAINPOOL384R1_TLS13_SHA384") {
103 }
104 if(str == "ECDSA_BRAINPOOL512R1_TLS13_SHA512") {
106 }
107
108 // Parse signature schemes passed as hexadecimal code points (e.g. "0x081A")
109 if(str.size() == 6 && str.starts_with("0x")) {
110 try {
111 std::array<uint8_t, 2> wire_code{};
112 Botan::hex_decode(wire_code, str.substr(2), false /* no white space */);
114 } catch(const Invalid_Argument&) {
115 // pass, will throw below
116 }
117 }
118
119 throw Invalid_Argument(fmt("Unknown TLS signature scheme '{}'", str));
120}
std::string fmt(std::string_view format, const T &... args)
Definition fmt.h:53
size_t hex_decode(uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool ignore_ws)
Definition hex.cpp:75
constexpr auto load_be(ParamTs &&... params)
Definition loadstor.h:504

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, ECDSA_SHA1, Botan::fmt(), Botan::hex_decode(), Botan::load_be(), RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, Signature_Scheme(), and wire_code().

Referenced by Botan::TLS::Text_Policy::read_sig_scheme_list().

◆ hash_function_name()

std::string Botan::TLS::Signature_Scheme::hash_function_name ( ) const

Definition at line 200 of file tls_signature_scheme.cpp.

200 {
201 switch(m_code) {
202 case RSA_PKCS1_SHA1:
203 case ECDSA_SHA1:
204 return "SHA-1";
205
207 case RSA_PKCS1_SHA256:
208 case RSA_PSS_SHA256:
210 return "SHA-256";
211
213 case RSA_PKCS1_SHA384:
214 case RSA_PSS_SHA384:
216 return "SHA-384";
217
219 case RSA_PKCS1_SHA512:
220 case RSA_PSS_SHA512:
222 return "SHA-512";
223
224 case EDDSA_25519:
225 case EDDSA_448:
226 return "Pure";
227
228 default:
229 return "Unknown hash function";
230 }
231}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, ECDSA_SHA1, EDDSA_25519, EDDSA_448, RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, and RSA_PSS_SHA512.

Referenced by Botan::TLS::Handshake_State::choose_sig_format().

◆ is_available()

bool Botan::TLS::Signature_Scheme::is_available ( ) const
noexcept
Returns
true if support for this scheme is implemented in this Botan build

Definition at line 128 of file tls_signature_scheme.cpp.

128 {
129 switch(m_code) {
130#if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_EMSA_PSSR)
131 case RSA_PSS_SHA384:
132 case RSA_PSS_SHA256:
133 case RSA_PSS_SHA512:
134#endif
135#if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_EMSA_PKCS1)
136 case RSA_PKCS1_SHA384:
137 case RSA_PKCS1_SHA512:
138 case RSA_PKCS1_SHA256:
139#endif
146 return true;
147 default:
148 return false;
149 }
150}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, and RSA_PSS_SHA512.

Referenced by Botan::TLS::Handshake_State::parse_sig_format().

◆ is_compatible_with()

bool Botan::TLS::Signature_Scheme::is_compatible_with ( const Protocol_Version & protocol_version) const
noexcept

Definition at line 411 of file tls_signature_scheme.cpp.

411 {
412 // RFC 8446 4.4.3:
413 // The SHA-1 algorithm MUST NOT be used in any signatures of
414 // CertificateVerify messages.
415 //
416 // Note that Botan enforces that for TLS 1.2 as well.
417 if(m_code == RSA_PKCS1_SHA1 || m_code == ECDSA_SHA1) {
418 return false;
419 }
420
421 // RFC 8446 4.4.3:
422 // RSA signatures MUST use an RSASSA-PSS algorithm, regardless of whether
423 // RSASSA-PKCS1-v1_5 algorithms appear in "signature_algorithms".
424 //
425 // Note that this is enforced for TLS 1.3 and above only.
426 if(!protocol_version.is_pre_tls_13() && (m_code == RSA_PKCS1_SHA1 || m_code == RSA_PKCS1_SHA256 ||
427 m_code == RSA_PKCS1_SHA384 || m_code == RSA_PKCS1_SHA512)) {
428 return false;
429 }
430
431 // RFC 8734 defines these code points for TLS 1.3 only
432 if(protocol_version.is_pre_tls_13() &&
435 return false;
436 }
437
438 return true;
439}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SHA1, RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, and RSA_PKCS1_SHA512.

Referenced by Botan::TLS::Handshake_State::parse_sig_format().

◆ is_set()

bool Botan::TLS::Signature_Scheme::is_set ( ) const
noexcept
Returns
true if the wire_code is set to any value other than NONE

Definition at line 152 of file tls_signature_scheme.cpp.

152 {
153 return m_code != NONE;
154}

References NONE.

Referenced by Botan::TLS::Handshake_State::choose_sig_format().

◆ is_suitable_for()

bool Botan::TLS::Signature_Scheme::is_suitable_for ( const Private_Key & private_key) const

Checks that private_key is suitable for use with this signature scheme, enforcing the curve-hash binding required by TLS 1.3 (e.g. ECDSA_SHA256 only with P-256 keys). This must not be used for TLS 1.2 scheme selection, where signature schemes are (hash, algorithm) pairs with no curve binding – any hash may be used with any ECDSA curve per RFC 5246.

Definition at line 441 of file tls_signature_scheme.cpp.

441 {
442 if(algorithm_name() != private_key.algo_name()) {
443 return false;
444 }
445
446 // Keys this small are not suitable for any scheme
447 const auto keylen = private_key.key_length();
448 if(keylen <= 250) {
449 return false;
450 }
451
452 // Each TLS 1.3 ECDSA scheme names the curve of the key
453 if(algorithm_name() == "ECDSA") {
454 // Compare the curve itself, as an EC_PublicKey may be set to encode it explicitly
455 if(const auto* ec_key = dynamic_cast<const EC_PublicKey*>(&private_key)) {
456 const auto& curve = ec_key->domain().get_curve_oid();
457 return curve.has_value() && curve.BER_encode() == key_algorithm_identifier().parameters();
458 }
459 return key_algorithm_identifier() == private_key.algorithm_identifier();
460 }
461
462 return true;
463}
const std::vector< uint8_t > & parameters() const
Definition asn1_obj.h:693
AlgorithmIdentifier key_algorithm_identifier() const

References Botan::Asymmetric_Key::algo_name(), Botan::Public_Key::algorithm_identifier(), algorithm_name(), key_algorithm_identifier(), Botan::Public_Key::key_length(), and Botan::AlgorithmIdentifier::parameters().

◆ key_algorithm_identifier()

AlgorithmIdentifier Botan::TLS::Signature_Scheme::key_algorithm_identifier ( ) const

Definition at line 303 of file tls_signature_scheme.cpp.

303 {
304 const auto der_encode_oid = [](const std::string_view oid_name) {
305 try {
306 if(auto oid = OID::from_name(oid_name)) {
307 return oid->BER_encode();
308 }
309 } catch(...) {}
311 };
312
313 switch(m_code) {
314 // case ECDSA_SHA1: not defined
316 return {"ECDSA", der_encode_oid("secp256r1")};
318 return {"ECDSA", der_encode_oid("secp384r1")};
320 return {"ECDSA", der_encode_oid("secp521r1")};
321
323 return {"ECDSA", der_encode_oid("brainpool256r1")};
325 return {"ECDSA", der_encode_oid("brainpool384r1")};
327 return {"ECDSA", der_encode_oid("brainpool512r1")};
328
329 case EDDSA_25519:
330 return {"Ed25519", AlgorithmIdentifier::USE_EMPTY_PARAM};
331 case EDDSA_448:
332 return {"Ed448", AlgorithmIdentifier::USE_EMPTY_PARAM};
333
334 case RSA_PKCS1_SHA1:
335 case RSA_PKCS1_SHA256:
336 case RSA_PKCS1_SHA384:
337 case RSA_PKCS1_SHA512:
338 case RSA_PSS_SHA256:
339 case RSA_PSS_SHA384:
340 case RSA_PSS_SHA512:
342
343 default:
344 return AlgorithmIdentifier();
345 }
346}
#define BOTAN_ASSERT_UNREACHABLE()
Definition assert.h:173
static std::optional< OID > from_name(std::string_view name)
Definition asn1_oid.cpp:66

References BOTAN_ASSERT_UNREACHABLE, ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, EDDSA_25519, EDDSA_448, Botan::OID::from_name(), RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, Botan::AlgorithmIdentifier::USE_EMPTY_PARAM, and Botan::AlgorithmIdentifier::USE_NULL_PARAM.

Referenced by is_suitable_for().

◆ operator!=()

bool Botan::TLS::Signature_Scheme::operator!= ( const Signature_Scheme & rhs) const
inline

Definition at line 138 of file tls_signature_scheme.h.

138{ return !(*this == rhs); }

References Signature_Scheme().

◆ operator==()

bool Botan::TLS::Signature_Scheme::operator== ( const Signature_Scheme & rhs) const
inline

Definition at line 136 of file tls_signature_scheme.h.

136{ return m_code == rhs.m_code; }

References Signature_Scheme().

◆ padding_string()

std::string Botan::TLS::Signature_Scheme::padding_string ( ) const

Definition at line 233 of file tls_signature_scheme.cpp.

233 {
234 switch(m_code) {
235 case RSA_PKCS1_SHA1:
236 return "PKCS1v15(SHA-1)";
237 case RSA_PKCS1_SHA256:
238 return "PKCS1v15(SHA-256)";
239 case RSA_PKCS1_SHA384:
240 return "PKCS1v15(SHA-384)";
241 case RSA_PKCS1_SHA512:
242 return "PKCS1v15(SHA-512)";
243
244 case ECDSA_SHA1:
245 return "SHA-1";
248 return "SHA-256";
251 return "SHA-384";
254 return "SHA-512";
255
256 case RSA_PSS_SHA256:
257 return "PSS(SHA-256,MGF1,32)";
258 case RSA_PSS_SHA384:
259 return "PSS(SHA-384,MGF1,48)";
260 case RSA_PSS_SHA512:
261 return "PSS(SHA-512,MGF1,64)";
262
263 case EDDSA_25519:
264 case EDDSA_448:
265 return "Pure";
266
267 default:
268 return "Unknown padding";
269 }
270}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, ECDSA_SHA1, EDDSA_25519, EDDSA_448, RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, and RSA_PSS_SHA512.

Referenced by Botan::TLS::Handshake_State::choose_sig_format(), and Botan::TLS::Handshake_State::parse_sig_format().

◆ to_string()

std::string Botan::TLS::Signature_Scheme::to_string ( ) const

Definition at line 156 of file tls_signature_scheme.cpp.

156 {
157 switch(m_code) {
158 case RSA_PKCS1_SHA1:
159 return "RSA_PKCS1_SHA1";
160 case RSA_PKCS1_SHA256:
161 return "RSA_PKCS1_SHA256";
162 case RSA_PKCS1_SHA384:
163 return "RSA_PKCS1_SHA384";
164 case RSA_PKCS1_SHA512:
165 return "RSA_PKCS1_SHA512";
166
167 case ECDSA_SHA1:
168 return "ECDSA_SHA1";
170 return "ECDSA_SHA256";
172 return "ECDSA_SHA384";
174 return "ECDSA_SHA512";
175
177 return "ECDSA_BRAINPOOL256R1_TLS13_SHA256";
179 return "ECDSA_BRAINPOOL384R1_TLS13_SHA384";
181 return "ECDSA_BRAINPOOL512R1_TLS13_SHA512";
182
183 case RSA_PSS_SHA256:
184 return "RSA_PSS_SHA256";
185 case RSA_PSS_SHA384:
186 return "RSA_PSS_SHA384";
187 case RSA_PSS_SHA512:
188 return "RSA_PSS_SHA512";
189
190 case EDDSA_25519:
191 return "EDDSA_25519";
192 case EDDSA_448:
193 return "EDDSA_448";
194
195 default:
196 return "Unknown signature scheme: " + std::to_string(m_code);
197 }
198}

References ECDSA_BRAINPOOL256R1_TLS13_SHA256, ECDSA_BRAINPOOL384R1_TLS13_SHA384, ECDSA_BRAINPOOL512R1_TLS13_SHA512, ECDSA_SECP256R1_TLS13_SHA256, ECDSA_SECP384R1_TLS13_SHA384, ECDSA_SECP521R1_TLS13_SHA512, ECDSA_SHA1, EDDSA_25519, EDDSA_448, RSA_PKCS1_SHA1, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, RSA_PSS_SHA256, RSA_PSS_SHA384, and RSA_PSS_SHA512.

Referenced by Botan::TLS::Handshake_State::parse_sig_format().

◆ wire_code()

Signature_Scheme::Code Botan::TLS::Signature_Scheme::wire_code ( ) const
inlinenoexcept

Definition at line 104 of file tls_signature_scheme.h.

104{ return m_code; }

Referenced by from_string(), Signature_Scheme(), and Signature_Scheme().


The documentation for this class was generated from the following files: