#include <scan_name.h>
A class encapsulating a SCAN name (similar to JCE conventions) http://www.users.zetnet.co.uk/hopwood/crypto/scan/
Definition at line 23 of file scan_name.h.
◆ SCAN_Name() [1/2]
Botan::SCAN_Name::SCAN_Name |
( |
const char * |
algo_spec | ) |
|
|
explicit |
Create a SCAN_Name
- Parameters
-
algo_spec | A SCAN-format name |
Definition at line 56 of file scan_name.cpp.
SCAN_Name(const char *algo_spec)
◆ SCAN_Name() [2/2]
Botan::SCAN_Name::SCAN_Name |
( |
std::string |
algo_spec | ) |
|
|
explicit |
Create a SCAN_Name
- Parameters
-
algo_spec | A SCAN-format name |
Definition at line 60 of file scan_name.cpp.
References name.
60 : m_orig_algo_spec(algo_spec), m_alg_name(), m_args(), m_mode_info()
62 if(algo_spec.size() == 0)
63 throw Invalid_Argument(
"Expected algorithm name, got empty string");
65 std::vector<std::pair<size_t, std::string>>
name;
67 std::pair<size_t, std::string> accum = std::make_pair(level,
"");
69 const std::string decoding_error =
"Bad SCAN name '" + algo_spec +
"': ";
71 for(
size_t i = 0; i != algo_spec.size(); ++i)
73 char c = algo_spec[i];
75 if(c ==
'/' || c ==
',' || c ==
'(' || c ==
')')
82 throw Decoding_Error(decoding_error +
"Mismatched parens");
86 if(c ==
'/' && level > 0)
87 accum.second.push_back(c);
90 if(accum.second !=
"")
91 name.push_back(accum);
92 accum = std::make_pair(level,
"");
96 accum.second.push_back(c);
99 if(accum.second !=
"")
100 name.push_back(accum);
103 throw Decoding_Error(decoding_error +
"Missing close paren");
106 throw Decoding_Error(decoding_error +
"Empty name");
108 m_alg_name =
name[0].second;
110 bool in_modes =
false;
112 for(
size_t i = 1; i !=
name.size(); ++i)
114 if(
name[i].first == 0)
116 m_mode_info.push_back(make_arg(
name, i));
119 else if(
name[i].first == 1 && !in_modes)
120 m_args.push_back(make_arg(
name, i));
◆ algo_name()
const std::string& Botan::SCAN_Name::algo_name |
( |
| ) |
const |
|
inline |
- Returns
- algorithm name
Definition at line 51 of file scan_name.h.
Referenced by Botan::commoncrypto_opts_from_algo(), Botan::HashFunction::create(), Botan::AEAD_Mode::create(), Botan::BlockCipher::create(), Botan::MessageAuthenticationCode::create(), Botan::KDF::create(), Botan::PBKDF::create(), Botan::StreamCipher::create(), Botan::Cipher_Mode::create(), Botan::PasswordHashFamily::create(), Botan::get_eme(), Botan::get_emsa(), and Botan::get_kdf().
51 {
return m_alg_name; }
◆ arg() [1/2]
std::string Botan::SCAN_Name::arg |
( |
size_t |
i | ) |
const |
- Parameters
-
- Returns
- ith argument
Definition at line 124 of file scan_name.cpp.
References arg_count(), to_string(), and Botan::ASN1::to_string().
Referenced by Botan::HashFunction::create(), Botan::AEAD_Mode::create(), Botan::MessageAuthenticationCode::create(), Botan::BlockCipher::create(), Botan::KDF::create(), Botan::StreamCipher::create(), Botan::PBKDF::create(), Botan::Cipher_Mode::create(), Botan::PasswordHashFamily::create(), Botan::PKCS11::MechanismWrapper::create_ecdh_mechanism(), Botan::get_eme(), Botan::get_emsa(), and Botan::hash_for_emsa().
128 " out of range for '" +
to_string() +
"'");
std::string to_string(const BER_Object &obj)
const std::string & to_string() const
◆ arg() [2/2]
std::string Botan::SCAN_Name::arg |
( |
size_t |
i, |
|
|
const std::string & |
def_value |
|
) |
| const |
- Parameters
-
i | which argument |
def_value | the default value |
- Returns
- ith argument or the default value
Definition at line 132 of file scan_name.cpp.
References arg_count().
◆ arg_as_integer()
size_t Botan::SCAN_Name::arg_as_integer |
( |
size_t |
i, |
|
|
size_t |
def_value |
|
) |
| const |
◆ arg_count()
size_t Botan::SCAN_Name::arg_count |
( |
| ) |
const |
|
inline |
- Returns
- number of arguments
Definition at line 56 of file scan_name.h.
Referenced by arg(), arg_as_integer(), Botan::HashFunction::create(), Botan::AEAD_Mode::create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::BlockCipher::create(), Botan::StreamCipher::create(), Botan::PBKDF::create(), Botan::Cipher_Mode::create(), Botan::PasswordHashFamily::create(), Botan::PKCS11::MechanismWrapper::create_ecdh_mechanism(), Botan::get_eme(), Botan::get_emsa(), and Botan::hash_for_emsa().
56 {
return m_args.size(); }
◆ arg_count_between()
bool Botan::SCAN_Name::arg_count_between |
( |
size_t |
lower, |
|
|
size_t |
upper |
|
) |
| const |
|
inline |
◆ as_string()
const std::string& Botan::SCAN_Name::as_string |
( |
| ) |
const |
|
inline |
◆ cipher_mode()
std::string Botan::SCAN_Name::cipher_mode |
( |
| ) |
const |
|
inline |
◆ cipher_mode_pad()
std::string Botan::SCAN_Name::cipher_mode_pad |
( |
| ) |
const |
|
inline |
◆ to_string()
const std::string& Botan::SCAN_Name::to_string |
( |
| ) |
const |
|
inline |
- Returns
- original input string
Definition at line 41 of file scan_name.h.
Referenced by arg().
41 {
return m_orig_algo_spec; }
The documentation for this class was generated from the following files: