Botan
3.8.1
Crypto and TLS for C&
src
lib
base
sym_algo.cpp
Go to the documentation of this file.
1
/*
2
* (C) 2018 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6
7
#include <botan/sym_algo.h>
8
9
#include <botan/exceptn.h>
10
#include <botan/symkey.h>
11
12
namespace
Botan
{
13
14
void
SymmetricAlgorithm::set_key
(
const
OctetString
& key) {
15
set_key
(std::span{key.
begin
(), key.
length
()});
16
}
17
18
void
SymmetricAlgorithm::throw_key_not_set_error()
const
{
19
throw
Key_Not_Set
(
name
());
20
}
21
22
void
SymmetricAlgorithm::set_key
(std::span<const uint8_t> key) {
23
if
(!
valid_keylength
(key.size())) {
24
throw
Invalid_Key_Length
(
name
(), key.size());
25
}
26
key_schedule(key);
27
}
28
29
}
// namespace Botan
Botan::Invalid_Key_Length
Definition
exceptn.h:153
Botan::Key_Not_Set
Definition
exceptn.h:225
Botan::OctetString
Definition
symkey.h:22
Botan::OctetString::begin
const uint8_t * begin() const
Definition
symkey.h:41
Botan::OctetString::length
size_t length() const
Definition
symkey.h:27
Botan::SymmetricAlgorithm::valid_keylength
bool valid_keylength(size_t length) const
Definition
sym_algo.h:109
Botan::SymmetricAlgorithm::name
virtual std::string name() const =0
Botan::SymmetricAlgorithm::set_key
void set_key(const OctetString &key)
Definition
sym_algo.cpp:14
Botan
Definition
alg_id.cpp:13
Generated by
1.13.2