Botan 1.10.17
Botan::Core_Engine Class Reference

#include <core_engine.h>

Inheritance diagram for Botan::Core_Engine:
Botan::Engine

Public Member Functions

BlockCipherfind_block_cipher (const SCAN_Name &, Algorithm_Factory &) const
HashFunctionfind_hash (const SCAN_Name &request, Algorithm_Factory &) const
MessageAuthenticationCodefind_mac (const SCAN_Name &request, Algorithm_Factory &) const
PBKDFfind_pbkdf (const SCAN_Name &algo_spec, Algorithm_Factory &af) const
StreamCipherfind_stream_cipher (const SCAN_Name &, Algorithm_Factory &) const
Keyed_Filterget_cipher (const std::string &, Cipher_Dir, Algorithm_Factory &)
PK_Ops::Decryptionget_decryption_op (const Private_Key &key) const
PK_Ops::Encryptionget_encryption_op (const Public_Key &key) const
PK_Ops::Key_Agreementget_key_agreement_op (const Private_Key &key) const
PK_Ops::Signatureget_signature_op (const Private_Key &key) const
PK_Ops::Verificationget_verify_op (const Public_Key &key) const
Modular_Exponentiatormod_exp (const BigInt &n, Power_Mod::Usage_Hints) const
std::string provider_name () const

Detailed Description

Core Engine

Definition at line 18 of file core_engine.h.

Member Function Documentation

◆ find_block_cipher()

BlockCipher * Botan::Core_Engine::find_block_cipher ( const SCAN_Name & algo_spec,
Algorithm_Factory & af ) const
virtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 119 of file lookup_block.cpp.

121 {
122
123#if defined(BOTAN_HAS_AES)
124 if(request.algo_name() == "AES-128")
125 return new AES_128;
126 if(request.algo_name() == "AES-192")
127 return new AES_192;
128 if(request.algo_name() == "AES-256")
129 return new AES_256;
130#endif
131
132#if defined(BOTAN_HAS_BLOWFISH)
133 if(request.algo_name() == "Blowfish")
134 return new Blowfish;
135#endif
136
137#if defined(BOTAN_HAS_CAMELLIA)
138 if(request.algo_name() == "Camellia-128")
139 return new Camellia_128;
140 if(request.algo_name() == "Camellia-192")
141 return new Camellia_192;
142 if(request.algo_name() == "Camellia-256")
143 return new Camellia_256;
144#endif
145
146#if defined(BOTAN_HAS_CAST)
147 if(request.algo_name() == "CAST-128")
148 return new CAST_128;
149 if(request.algo_name() == "CAST-256")
150 return new CAST_256;
151#endif
152
153#if defined(BOTAN_HAS_DES)
154 if(request.algo_name() == "DES")
155 return new DES;
156 if(request.algo_name() == "DESX")
157 return new DESX;
158 if(request.algo_name() == "TripleDES")
159 return new TripleDES;
160#endif
161
162#if defined(BOTAN_HAS_GOST_28147_89)
163 if(request.algo_name() == "GOST-28147-89")
164 return new GOST_28147_89(request.arg(0, "R3411_94_TestParam"));
165#endif
166
167#if defined(BOTAN_HAS_IDEA)
168 if(request.algo_name() == "IDEA")
169 return new IDEA;
170#endif
171
172#if defined(BOTAN_HAS_KASUMI)
173 if(request.algo_name() == "KASUMI")
174 return new KASUMI;
175#endif
176
177#if defined(BOTAN_HAS_MARS)
178 if(request.algo_name() == "MARS")
179 return new MARS;
180#endif
181
182#if defined(BOTAN_HAS_MISTY1)
183 if(request.algo_name() == "MISTY1")
184 return new MISTY1(request.arg_as_integer(0, 8));
185#endif
186
187#if defined(BOTAN_HAS_NOEKEON)
188 if(request.algo_name() == "Noekeon")
189 return new Noekeon;
190#endif
191
192#if defined(BOTAN_HAS_RC2)
193 if(request.algo_name() == "RC2")
194 return new RC2;
195#endif
196
197#if defined(BOTAN_HAS_RC5)
198 if(request.algo_name() == "RC5")
199 return new RC5(request.arg_as_integer(0, 12));
200#endif
201
202#if defined(BOTAN_HAS_RC6)
203 if(request.algo_name() == "RC6")
204 return new RC6;
205#endif
206
207#if defined(BOTAN_HAS_SAFER)
208 if(request.algo_name() == "SAFER-SK")
209 return new SAFER_SK(request.arg_as_integer(0, 10));
210#endif
211
212#if defined(BOTAN_HAS_SEED)
213 if(request.algo_name() == "SEED")
214 return new SEED;
215#endif
216
217#if defined(BOTAN_HAS_SERPENT)
218 if(request.algo_name() == "Serpent")
219 return new Serpent;
220#endif
221
222#if defined(BOTAN_HAS_SKIPJACK)
223 if(request.algo_name() == "Skipjack")
224 return new Skipjack;
225#endif
226
227#if defined(BOTAN_HAS_SQUARE)
228 if(request.algo_name() == "Square")
229 return new Square;
230#endif
231
232#if defined(BOTAN_HAS_TEA)
233 if(request.algo_name() == "TEA")
234 return new TEA;
235#endif
236
237#if defined(BOTAN_HAS_TWOFISH)
238 if(request.algo_name() == "Twofish")
239 return new Twofish;
240#endif
241
242#if defined(BOTAN_HAS_XTEA)
243 if(request.algo_name() == "XTEA")
244 return new XTEA;
245#endif
246
247#if defined(BOTAN_HAS_LUBY_RACKOFF)
248 if(request.algo_name() == "Luby-Rackoff" && request.arg_count() == 1)
249 {
250 const HashFunction* hash = af.prototype_hash_function(request.arg(0));
251
252 if(hash)
253 return new LubyRackoff(hash->clone());
254 }
255#endif
256
257#if defined(BOTAN_HAS_CASCADE)
258 if(request.algo_name() == "Cascade" && request.arg_count() == 2)
259 {
260 const BlockCipher* c1 = af.prototype_block_cipher(request.arg(0));
261 const BlockCipher* c2 = af.prototype_block_cipher(request.arg(1));
262
263 if(c1 && c2)
264 return new Cascade_Cipher(c1->clone(), c2->clone());
265 }
266#endif
267
268#if defined(BOTAN_HAS_LION)
269 if(request.algo_name() == "Lion" && request.arg_count_between(2, 3))
270 {
271 const size_t block_size = request.arg_as_integer(2, 1024);
272
273 const HashFunction* hash =
274 af.prototype_hash_function(request.arg(0));
275
276 const StreamCipher* stream_cipher =
277 af.prototype_stream_cipher(request.arg(1));
278
279 if(!hash || !stream_cipher)
280 return 0;
281
282 return new Lion(hash->clone(), stream_cipher->clone(), block_size);
283 }
284#endif
285
286 return 0;
287 }
Cascade_Cipher(BlockCipher *cipher1, BlockCipher *cipher2)
Definition cascade.cpp:83
GOST_28147_89(const GOST_28147_89_Params &params)
Lion(HashFunction *hash, StreamCipher *cipher, size_t block_size)
Definition lion.cpp:111
LubyRackoff(HashFunction *hash)
Definition lubyrack.cpp:127
MISTY1(size_t rounds=8)
Definition misty1.cpp:254
SAFER_SK(size_t rounds)
Definition safer_sk.cpp:247

References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), Botan::SCAN_Name::arg_count_between(), Botan::Cascade_Cipher::Cascade_Cipher(), Botan::BlockCipher::clone(), Botan::HashFunction::clone(), Botan::StreamCipher::clone(), Botan::GOST_28147_89::GOST_28147_89(), Botan::Lion::Lion(), Botan::LubyRackoff::LubyRackoff(), Botan::MISTY1::MISTY1(), Botan::Algorithm_Factory::prototype_block_cipher(), Botan::Algorithm_Factory::prototype_hash_function(), Botan::Algorithm_Factory::prototype_stream_cipher(), and Botan::SAFER_SK::SAFER_SK().

◆ find_hash()

HashFunction * Botan::Core_Engine::find_hash ( const SCAN_Name & algo_spec,
Algorithm_Factory & af ) const
virtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 98 of file lookup_hash.cpp.

100 {
101#if defined(BOTAN_HAS_ADLER32)
102 if(request.algo_name() == "Adler32")
103 return new Adler32;
104#endif
105
106#if defined(BOTAN_HAS_CRC24)
107 if(request.algo_name() == "CRC24")
108 return new CRC24;
109#endif
110
111#if defined(BOTAN_HAS_CRC32)
112 if(request.algo_name() == "CRC32")
113 return new CRC32;
114#endif
115
116#if defined(BOTAN_HAS_BMW_512)
117 if(request.algo_name() == "BMW-512")
118 return new BMW_512;
119#endif
120
121#if defined(BOTAN_HAS_GOST_34_11)
122 if(request.algo_name() == "GOST-34.11")
123 return new GOST_34_11;
124#endif
125
126#if defined(BOTAN_HAS_HAS_160)
127 if(request.algo_name() == "HAS-160")
128 return new HAS_160;
129#endif
130
131#if defined(BOTAN_HAS_KECCAK)
132 if(request.algo_name() == "Keccak-1600")
133 return new Keccak_1600(request.arg_as_integer(0, 512));
134#endif
135
136#if defined(BOTAN_HAS_MD2)
137 if(request.algo_name() == "MD2")
138 return new MD2;
139#endif
140
141#if defined(BOTAN_HAS_MD4)
142 if(request.algo_name() == "MD4")
143 return new MD4;
144#endif
145
146#if defined(BOTAN_HAS_MD5)
147 if(request.algo_name() == "MD5")
148 return new MD5;
149#endif
150
151#if defined(BOTAN_HAS_RIPEMD_128)
152 if(request.algo_name() == "RIPEMD-128")
153 return new RIPEMD_128;
154#endif
155
156#if defined(BOTAN_HAS_RIPEMD_160)
157 if(request.algo_name() == "RIPEMD-160")
158 return new RIPEMD_160;
159#endif
160
161#if defined(BOTAN_HAS_SHA1)
162 if(request.algo_name() == "SHA-160")
163 return new SHA_160;
164#endif
165
166#if defined(BOTAN_HAS_SHA2_32)
167 if(request.algo_name() == "SHA-224")
168 return new SHA_224;
169 if(request.algo_name() == "SHA-256")
170 return new SHA_256;
171#endif
172
173#if defined(BOTAN_HAS_SHA2_64)
174 if(request.algo_name() == "SHA-384")
175 return new SHA_384;
176 if(request.algo_name() == "SHA-512")
177 return new SHA_512;
178#endif
179
180#if defined(BOTAN_HAS_TIGER)
181 if(request.algo_name() == "Tiger")
182 return new Tiger(request.arg_as_integer(0, 24), // hash output
183 request.arg_as_integer(1, 3)); // # passes
184#endif
185
186#if defined(BOTAN_HAS_SKEIN_512)
187 if(request.algo_name() == "Skein-512")
188 return new Skein_512(request.arg_as_integer(0, 512),
189 request.arg(1, ""));
190#endif
191
192#if defined(BOTAN_HAS_WHIRLPOOL)
193 if(request.algo_name() == "Whirlpool")
194 return new Whirlpool;
195#endif
196
197#if defined(BOTAN_HAS_COMB4P)
198 if(request.algo_name() == "Comb4P" && request.arg_count() == 2)
199 {
200 const HashFunction* h1 = af.prototype_hash_function(request.arg(0));
201 const HashFunction* h2 = af.prototype_hash_function(request.arg(1));
202
203 if(h1 && h2)
204 return new Comb4P(h1->clone(), h2->clone());
205 }
206#endif
207
208#if defined(BOTAN_HAS_PARALLEL_HASH)
209
210 if(request.algo_name() == "Parallel")
211 {
212 std::vector<const HashFunction*> hash_prototypes;
213
214 /* First pass, just get the prototypes (no memory allocation). Then
215 if all were found, replace each prototype with a newly created clone
216 */
217 for(size_t i = 0; i != request.arg_count(); ++i)
218 {
219 const HashFunction* hash = af.prototype_hash_function(request.arg(i));
220 if(!hash)
221 return 0;
222
223 hash_prototypes.push_back(hash);
224 }
225
226 std::vector<HashFunction*> hashes;
227 for(size_t i = 0; i != hash_prototypes.size(); ++i)
228 hashes.push_back(hash_prototypes[i]->clone());
229
230 return new Parallel(hashes);
231 }
232
233#endif
234
235 return 0;
236 }
Comb4P(HashFunction *h1, HashFunction *h2)
Definition comb4p.cpp:37
Keccak_1600(size_t output_bits=512)
Definition keccak.cpp:104
Parallel(const std::vector< HashFunction * > &hashes)
Definition par_hash.cpp:83
Skein_512(size_t output_bits=512, const std::string &personalization="")
Tiger(size_t out_size=24, size_t passes=3)
Definition tiger.cpp:169

References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), Botan::HashFunction::clone(), Botan::Comb4P::Comb4P(), Botan::Keccak_1600::Keccak_1600(), Botan::Parallel::Parallel(), Botan::Algorithm_Factory::prototype_hash_function(), Botan::Skein_512::Skein_512(), and Botan::Tiger::Tiger().

◆ find_mac()

MessageAuthenticationCode * Botan::Core_Engine::find_mac ( const SCAN_Name & algo_spec,
Algorithm_Factory & af ) const
virtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 38 of file lookup_mac.cpp.

40 {
41
42#if defined(BOTAN_HAS_CBC_MAC)
43 if(request.algo_name() == "CBC-MAC" && request.arg_count() == 1)
44 return new CBC_MAC(af.make_block_cipher(request.arg(0)));
45#endif
46
47#if defined(BOTAN_HAS_CMAC)
48 if(request.algo_name() == "CMAC" && request.arg_count() == 1)
49 return new CMAC(af.make_block_cipher(request.arg(0)));
50#endif
51
52#if defined(BOTAN_HAS_HMAC)
53 if(request.algo_name() == "HMAC" && request.arg_count() == 1)
54 return new HMAC(af.make_hash_function(request.arg(0)));
55#endif
56
57#if defined(BOTAN_HAS_SSL3_MAC)
58 if(request.algo_name() == "SSL3-MAC" && request.arg_count() == 1)
59 return new SSL3_MAC(af.make_hash_function(request.arg(0)));
60#endif
61
62#if defined(BOTAN_HAS_ANSI_X919_MAC)
63 if(request.algo_name() == "X9.19-MAC" && request.arg_count() == 0)
64 return new ANSI_X919_MAC(af.make_block_cipher("DES"));
65#endif
66
67 return 0;
68 }
ANSI_X919_MAC(BlockCipher *cipher)
Definition x919_mac.cpp:87
CBC_MAC(BlockCipher *cipher)
Definition cbc_mac.cpp:91
CMAC(BlockCipher *cipher)
Definition cmac.cpp:132
HMAC(HashFunction *hash)
Definition hmac.cpp:87
SSL3_MAC(HashFunction *hash)
Definition ssl3_mac.cpp:75

References Botan::SCAN_Name::algo_name(), Botan::ANSI_X919_MAC::ANSI_X919_MAC(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), Botan::CBC_MAC::CBC_MAC(), Botan::CMAC::CMAC(), Botan::HMAC::HMAC(), Botan::Algorithm_Factory::make_block_cipher(), Botan::Algorithm_Factory::make_hash_function(), and Botan::SSL3_MAC::SSL3_MAC().

◆ find_pbkdf()

PBKDF * Botan::Core_Engine::find_pbkdf ( const SCAN_Name & algo_spec,
Algorithm_Factory & af ) const
virtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 26 of file lookup_pbkdf.cpp.

28 {
29#if defined(BOTAN_HAS_PBKDF1)
30 if(algo_spec.algo_name() == "PBKDF1" && algo_spec.arg_count() == 1)
31 return new PKCS5_PBKDF1(af.make_hash_function(algo_spec.arg(0)));
32#endif
33
34#if defined(BOTAN_HAS_PBKDF2)
35 if(algo_spec.algo_name() == "PBKDF2" && algo_spec.arg_count() == 1)
36 {
37 if(const MessageAuthenticationCode* mac_proto = af.prototype_mac(algo_spec.arg(0)))
38 return new PKCS5_PBKDF2(mac_proto->clone());
39
40 return new PKCS5_PBKDF2(af.make_mac("HMAC(" + algo_spec.arg(0) + ")"));
41 }
42#endif
43
44#if defined(BOTAN_HAS_PGPS2K)
45 if(algo_spec.algo_name() == "OpenPGP-S2K" && algo_spec.arg_count() == 1)
46 return new OpenPGP_S2K(af.make_hash_function(algo_spec.arg(0)));
47#endif
48
49 return 0;
50 }
OpenPGP_S2K(HashFunction *hash_in)
Definition pgp_s2k.h:25
PKCS5_PBKDF1(HashFunction *hash_in)
Definition pbkdf1.h:28
PKCS5_PBKDF2(MessageAuthenticationCode *mac_fn)
Definition pbkdf2.h:41

References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), Botan::Algorithm_Factory::make_hash_function(), Botan::Algorithm_Factory::make_mac(), Botan::OpenPGP_S2K::OpenPGP_S2K(), Botan::PKCS5_PBKDF1::PKCS5_PBKDF1(), Botan::PKCS5_PBKDF2::PKCS5_PBKDF2(), and Botan::Algorithm_Factory::prototype_mac().

◆ find_stream_cipher()

StreamCipher * Botan::Core_Engine::find_stream_cipher ( const SCAN_Name & algo_spec,
Algorithm_Factory & af ) const
virtual
Parameters
algo_specthe algorithm name/specification
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 33 of file lookup_stream.cpp.

35 {
36#if defined(BOTAN_HAS_ARC4)
37 if(request.algo_name() == "ARC4")
38 return new ARC4(request.arg_as_integer(0, 0));
39 if(request.algo_name() == "RC4_drop")
40 return new ARC4(768);
41#endif
42
43#if defined(BOTAN_HAS_SALSA20)
44 if(request.algo_name() == "Salsa20")
45 return new Salsa20;
46#endif
47
48#if defined(BOTAN_HAS_TURING)
49 if(request.algo_name() == "Turing")
50 return new Turing;
51#endif
52
53#if defined(BOTAN_HAS_WID_WAKE)
54 if(request.algo_name() == "WiderWake4+1-BE")
55 return new WiderWake_41_BE;
56#endif
57
58 return 0;
59 }
ARC4(size_t skip=0)
Definition arc4.cpp:104

References Botan::SCAN_Name::algo_name(), Botan::ARC4::ARC4(), and Botan::SCAN_Name::arg_as_integer().

◆ get_cipher()

Keyed_Filter * Botan::Core_Engine::get_cipher ( const std::string & algo_spec,
Cipher_Dir dir,
Algorithm_Factory & af )
virtual

Return a new cipher object

Parameters
algo_specthe algorithm name/specification
dirspecifies if encryption or decryption is desired
afan algorithm factory object
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 181 of file core_modes.cpp.

184 {
185 std::vector<std::string> algo_parts = split_on(algo_spec, '/');
186 if(algo_parts.empty())
187 throw Invalid_Algorithm_Name(algo_spec);
188
189 const std::string cipher_name = algo_parts[0];
190
191 // check if it is a stream cipher first (easy case)
192 const StreamCipher* stream_cipher = af.prototype_stream_cipher(cipher_name);
193 if(stream_cipher)
194 return new StreamCipher_Filter(stream_cipher->clone());
195
196 const BlockCipher* block_cipher = af.prototype_block_cipher(cipher_name);
197 if(!block_cipher)
198 return 0;
199
200 if(algo_parts.size() >= 4)
201 return 0; // 4 part mode, not something we know about
202
203 if(algo_parts.size() < 2)
204 throw Lookup_Error("Cipher specification '" + algo_spec +
205 "' is missing mode identifier");
206
207 std::string mode = algo_parts[1];
208
209 std::string padding;
210 if(algo_parts.size() == 3)
211 padding = algo_parts[2];
212 else
213 padding = (mode == "CBC") ? "PKCS7" : "NoPadding";
214
215 if(mode == "ECB" && padding == "CTS")
216 return 0;
217 else if((mode != "CBC" && mode != "ECB") && padding != "NoPadding")
218 throw Invalid_Algorithm_Name(algo_spec);
219
220 Keyed_Filter* filt = get_cipher_mode(block_cipher, direction, mode, padding);
221 if(filt)
222 return filt;
223
224 throw Algorithm_Not_Found(cipher_name + "/" + mode + "/" + padding);
225 }
StreamCipher_Filter(StreamCipher *cipher_obj)
Definition algo_filt.cpp:17
std::vector< std::string > split_on(const std::string &str, char delim)
Definition parsing.cpp:152
Keyed_Filter * get_cipher_mode(const BlockCipher *block_cipher, Cipher_Dir direction, const std::string &mode, const std::string &padding)
Algorithm_Not_Found(const std::string &name)
Definition exceptn.h:111
Invalid_Algorithm_Name(const std::string &name)
Definition exceptn.h:121
Lookup_Error(const std::string &err)
Definition exceptn.h:37

References Botan::Algorithm_Not_Found::Algorithm_Not_Found(), Botan::StreamCipher::clone(), Botan::get_cipher_mode(), Botan::Invalid_Algorithm_Name::Invalid_Algorithm_Name(), Botan::Lookup_Error::Lookup_Error(), Botan::Algorithm_Factory::prototype_block_cipher(), Botan::Algorithm_Factory::prototype_stream_cipher(), Botan::split_on(), and Botan::StreamCipher_Filter::StreamCipher_Filter().

◆ get_decryption_op()

PK_Ops::Decryption * Botan::Core_Engine::get_decryption_op ( const Private_Key & key) const
virtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 65 of file def_pk_ops.cpp.

66 {
67#if defined(BOTAN_HAS_RSA)
68 if(const RSA_PrivateKey* s = dynamic_cast<const RSA_PrivateKey*>(&key))
69 return new RSA_Private_Operation(*s);
70#endif
71
72#if defined(BOTAN_HAS_ELGAMAL)
73 if(const ElGamal_PrivateKey* s = dynamic_cast<const ElGamal_PrivateKey*>(&key))
74 return new ElGamal_Decryption_Operation(*s);
75#endif
76
77 return 0;
78 }
ElGamal_Decryption_Operation(const ElGamal_PrivateKey &key)
Definition elgamal.cpp:101
RSA_Private_Operation(const RSA_PrivateKey &rsa)
Definition rsa.cpp:63

References Botan::ElGamal_Decryption_Operation::ElGamal_Decryption_Operation(), and Botan::RSA_Private_Operation::RSA_Private_Operation().

◆ get_encryption_op()

PK_Ops::Encryption * Botan::Core_Engine::get_encryption_op ( const Public_Key & key) const
virtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 49 of file def_pk_ops.cpp.

50 {
51#if defined(BOTAN_HAS_RSA)
52 if(const RSA_PublicKey* s = dynamic_cast<const RSA_PublicKey*>(&key))
53 return new RSA_Public_Operation(*s);
54#endif
55
56#if defined(BOTAN_HAS_ELGAMAL)
57 if(const ElGamal_PublicKey* s = dynamic_cast<const ElGamal_PublicKey*>(&key))
58 return new ElGamal_Encryption_Operation(*s);
59#endif
60
61 return 0;
62 }
ElGamal_Encryption_Operation(const ElGamal_PublicKey &key)
Definition elgamal.cpp:70
RSA_Public_Operation(const RSA_PublicKey &rsa)
Definition rsa.h:120

References Botan::ElGamal_Encryption_Operation::ElGamal_Encryption_Operation(), and Botan::RSA_Public_Operation::RSA_Public_Operation().

◆ get_key_agreement_op()

PK_Ops::Key_Agreement * Botan::Core_Engine::get_key_agreement_op ( const Private_Key & key) const
virtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 81 of file def_pk_ops.cpp.

82 {
83#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
84 if(const DH_PrivateKey* dh = dynamic_cast<const DH_PrivateKey*>(&key))
85 return new DH_KA_Operation(*dh);
86#endif
87
88#if defined(BOTAN_HAS_ECDH)
89 if(const ECDH_PrivateKey* ecdh = dynamic_cast<const ECDH_PrivateKey*>(&key))
90 return new ECDH_KA_Operation(*ecdh);
91#endif
92
93 return 0;
94 }
DH_KA_Operation(const DH_PrivateKey &key)
Definition dh.cpp:79
ECDH_KA_Operation(const ECDH_PrivateKey &key)
Definition ecdh.cpp:15

References Botan::DH_KA_Operation::DH_KA_Operation(), and Botan::ECDH_KA_Operation::ECDH_KA_Operation().

◆ get_signature_op()

PK_Ops::Signature * Botan::Core_Engine::get_signature_op ( const Private_Key & key) const
virtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 97 of file def_pk_ops.cpp.

98 {
99#if defined(BOTAN_HAS_RSA)
100 if(const RSA_PrivateKey* s = dynamic_cast<const RSA_PrivateKey*>(&key))
101 return new RSA_Private_Operation(*s);
102#endif
103
104#if defined(BOTAN_HAS_RW)
105 if(const RW_PrivateKey* s = dynamic_cast<const RW_PrivateKey*>(&key))
106 return new RW_Signature_Operation(*s);
107#endif
108
109#if defined(BOTAN_HAS_DSA)
110 if(const DSA_PrivateKey* s = dynamic_cast<const DSA_PrivateKey*>(&key))
111 return new DSA_Signature_Operation(*s);
112#endif
113
114#if defined(BOTAN_HAS_ECDSA)
115 if(const ECDSA_PrivateKey* s = dynamic_cast<const ECDSA_PrivateKey*>(&key))
116 return new ECDSA_Signature_Operation(*s);
117#endif
118
119#if defined(BOTAN_HAS_GOST_34_10_2001)
120 if(const GOST_3410_PrivateKey* s =
121 dynamic_cast<const GOST_3410_PrivateKey*>(&key))
122 return new GOST_3410_Signature_Operation(*s);
123#endif
124
125#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
126 if(const NR_PrivateKey* s = dynamic_cast<const NR_PrivateKey*>(&key))
127 return new NR_Signature_Operation(*s);
128#endif
129
130 return 0;
131 }
DSA_Signature_Operation(const DSA_PrivateKey &dsa)
Definition dsa.cpp:68
ECDSA_Signature_Operation(const ECDSA_PrivateKey &ecdsa)
Definition ecdsa.cpp:27
NR_Signature_Operation(const NR_PrivateKey &nr)
Definition nr.cpp:74
RW_Signature_Operation(const RW_PrivateKey &rw)
Definition rw.cpp:62

References Botan::DSA_Signature_Operation::DSA_Signature_Operation(), Botan::ECDSA_Signature_Operation::ECDSA_Signature_Operation(), Botan::NR_Signature_Operation::NR_Signature_Operation(), Botan::RSA_Private_Operation::RSA_Private_Operation(), and Botan::RW_Signature_Operation::RW_Signature_Operation().

◆ get_verify_op()

PK_Ops::Verification * Botan::Core_Engine::get_verify_op ( const Public_Key & key) const
virtual

Return a new operator object for this key, if possible

Parameters
keythe key we want an operator for
Returns
newly allocated operator object, or NULL

Reimplemented from Botan::Engine.

Definition at line 134 of file def_pk_ops.cpp.

135 {
136#if defined(BOTAN_HAS_RSA)
137 if(const RSA_PublicKey* s = dynamic_cast<const RSA_PublicKey*>(&key))
138 return new RSA_Public_Operation(*s);
139#endif
140
141#if defined(BOTAN_HAS_RW)
142 if(const RW_PublicKey* s = dynamic_cast<const RW_PublicKey*>(&key))
143 return new RW_Verification_Operation(*s);
144#endif
145
146#if defined(BOTAN_HAS_DSA)
147 if(const DSA_PublicKey* s = dynamic_cast<const DSA_PublicKey*>(&key))
148 return new DSA_Verification_Operation(*s);
149#endif
150
151#if defined(BOTAN_HAS_ECDSA)
152 if(const ECDSA_PublicKey* s = dynamic_cast<const ECDSA_PublicKey*>(&key))
153 return new ECDSA_Verification_Operation(*s);
154#endif
155
156#if defined(BOTAN_HAS_GOST_34_10_2001)
157 if(const GOST_3410_PublicKey* s =
158 dynamic_cast<const GOST_3410_PublicKey*>(&key))
159 return new GOST_3410_Verification_Operation(*s);
160#endif
161
162#if defined(BOTAN_HAS_NYBERG_RUEPPEL)
163 if(const NR_PublicKey* s = dynamic_cast<const NR_PublicKey*>(&key))
164 return new NR_Verification_Operation(*s);
165#endif
166
167 return 0;
168 }
DSA_Verification_Operation(const DSA_PublicKey &dsa)
Definition dsa.cpp:102
ECDSA_Verification_Operation(const ECDSA_PublicKey &ecdsa)
Definition ecdsa.cpp:65
NR_Verification_Operation(const NR_PublicKey &nr)
Definition nr.cpp:112
RW_Verification_Operation(const RW_PublicKey &rw)
Definition rw.h:91

References Botan::DSA_Verification_Operation::DSA_Verification_Operation(), Botan::ECDSA_Verification_Operation::ECDSA_Verification_Operation(), Botan::NR_Verification_Operation::NR_Verification_Operation(), Botan::RSA_Public_Operation::RSA_Public_Operation(), and Botan::RW_Verification_Operation::RW_Verification_Operation().

◆ mod_exp()

Modular_Exponentiator * Botan::Core_Engine::mod_exp ( const BigInt & n,
Power_Mod::Usage_Hints hints ) const
virtual
Parameters
nthe modulus
hintsany use hints
Returns
newly allocated object, or NULL

Reimplemented from Botan::Engine.

Definition at line 17 of file def_powm.cpp.

18 {
19 if(n.is_odd())
20 return new Montgomery_Exponentiator(n, hints);
21 return new Fixed_Window_Exponentiator(n, hints);
22 }
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition powm_fw.cpp:61
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition powm_mnt.cpp:130

References Botan::Fixed_Window_Exponentiator::Fixed_Window_Exponentiator(), Botan::BigInt::is_odd(), and Botan::Montgomery_Exponentiator::Montgomery_Exponentiator().

◆ provider_name()

std::string Botan::Core_Engine::provider_name ( ) const
inlinevirtual
Returns
name of this engine

Implements Botan::Engine.

Definition at line 21 of file core_engine.h.

21{ return "core"; }

The documentation for this class was generated from the following files: