Botan 3.3.0
Crypto and TLS for C&
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
11namespace Botan {
12
13void SymmetricAlgorithm::throw_key_not_set_error() const {
14 throw Key_Not_Set(name());
15}
16
17void SymmetricAlgorithm::set_key(std::span<const uint8_t> key) {
18 if(!valid_keylength(key.size())) {
19 throw Invalid_Key_Length(name(), key.size());
20 }
21 key_schedule(key);
22}
23
24} // namespace Botan
bool valid_keylength(size_t length) const
Definition sym_algo.h:107
void set_key(const SymmetricKey &key)
Definition sym_algo.h:113
virtual std::string name() const =0