Botan 3.6.1
Crypto and TLS for C&
pss_params.h
Go to the documentation of this file.
1/*
2* (C) 2017 Daniel Neus
3* 2023 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_PSS_PARAMS_H_
9#define BOTAN_PSS_PARAMS_H_
10
11#include <botan/asn1_obj.h>
12#include <string>
13
14namespace Botan {
15
17 public:
18 static PSS_Params from_emsa_name(std::string_view emsa_name);
19
20 PSS_Params(std::string_view hash_fn, size_t salt_len);
21
22 PSS_Params(const uint8_t der[], size_t der_len);
23
24 template <typename Alloc>
25 PSS_Params(const std::vector<uint8_t, Alloc>& vec) : PSS_Params(vec.data(), vec.size()) {}
26
27 const AlgorithmIdentifier& hash_algid() const { return m_hash; }
28
29 const AlgorithmIdentifier& mgf_algid() const { return m_mgf; }
30
31 const AlgorithmIdentifier& mgf_hash_algid() const { return m_mgf_hash; }
32
33 size_t salt_length() const { return m_salt_len; }
34
35 size_t trailer_field() const { return m_trailer_field; }
36
37 std::string hash_function() const { return hash_algid().oid().to_formatted_string(); }
38
39 std::string mgf_function() const { return mgf_algid().oid().to_formatted_string(); }
40
41 std::vector<uint8_t> serialize() const;
42
43 void encode_into(DER_Encoder& to) const override;
44
45 void decode_from(BER_Decoder& from) override;
46
47 private:
50 AlgorithmIdentifier m_mgf_hash;
51 size_t m_salt_len;
52 size_t m_trailer_field;
53};
54
55} // namespace Botan
56
57#endif
const OID & oid() const
Definition asn1_obj.h:464
std::string to_formatted_string() const
Definition asn1_oid.cpp:139
void encode_into(DER_Encoder &to) const override
size_t trailer_field() const
Definition pss_params.h:35
size_t salt_length() const
Definition pss_params.h:33
std::vector< uint8_t > serialize() const
const AlgorithmIdentifier & hash_algid() const
Definition pss_params.h:27
PSS_Params(std::string_view hash_fn, size_t salt_len)
static PSS_Params from_emsa_name(std::string_view emsa_name)
const AlgorithmIdentifier & mgf_algid() const
Definition pss_params.h:29
std::string mgf_function() const
Definition pss_params.h:39
void decode_from(BER_Decoder &from) override
PSS_Params(const std::vector< uint8_t, Alloc > &vec)
Definition pss_params.h:25
std::string hash_function() const
Definition pss_params.h:37
const AlgorithmIdentifier & mgf_hash_algid() const
Definition pss_params.h:31
int(* final)(unsigned char *, CTX *)