/src/botan/src/lib/base/sym_algo.cpp
Line | Count | Source |
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 | 0 | void SymmetricAlgorithm::set_key(const OctetString& key) { |
15 | 0 | set_key(std::span{key.begin(), key.length()}); |
16 | 0 | } |
17 | | |
18 | 0 | void SymmetricAlgorithm::throw_key_not_set_error() const { |
19 | 0 | throw Key_Not_Set(name()); |
20 | 0 | } |
21 | | |
22 | 0 | void SymmetricAlgorithm::set_key(std::span<const uint8_t> key) { |
23 | 0 | if(!valid_keylength(key.size())) { |
24 | 0 | throw Invalid_Key_Length(name(), key.size()); |
25 | 0 | } |
26 | 0 | key_schedule(key); |
27 | 0 | } |
28 | | |
29 | | } // namespace Botan |