Botan 2.19.5 Crypto and TLS for C&

lookup.h
Go to the documentation of this file.
1/*
2* Algorithm Lookup
3* (C) 1999-2007,2015 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_LOOKUP_H_
9#define BOTAN_LOOKUP_H_
10
11#include <botan/build.h>
12#include <botan/exceptn.h>
13#include <string>
14#include <vector>
15#include <memory>
16
17#if defined(BOTAN_HAS_BLOCK_CIPHER)
18 #include <botan/block_cipher.h>
19#endif
20
21#if defined(BOTAN_HAS_STREAM_CIPHER)
22 #include <botan/stream_cipher.h>
23#endif
24
25#if defined(BOTAN_HAS_HASH)
26 #include <botan/hash.h>
27#endif
28
29#if defined(BOTAN_HAS_MAC)
30 #include <botan/mac.h>
31#endif
32
33 namespace Botan {
34
35 BOTAN_DEPRECATED_HEADER(lookup.h)
36
37/*
38* As of 1.11.26 this header is deprecated. Instead use the calls T::create and
39* T::providers (as demonstrated in the implementation below).
40*/
41
42/*
43* Get an algorithm object
44* NOTE: these functions create and return new objects, letting the
45* caller assume ownership of them
46*/
47
48#if defined(BOTAN_HAS_BLOCK_CIPHER)
49
50/**
51* Block cipher factory method.
52*
53* @param algo_spec the name of the desired block cipher
54* @param provider the provider to use
55* @return pointer to the block cipher object
56*/
57BOTAN_DEPRECATED("Use BlockCipher::create")
58inline BlockCipher* get_block_cipher(const std::string& algo_spec,
59 const std::string& provider = "")
60 {
61 return BlockCipher::create(algo_spec, provider).release();
62 }
63
64BOTAN_DEPRECATED("Use BlockCipher::create_or_throw")
65inline std::unique_ptr<BlockCipher> make_block_cipher(const std::string& algo_spec,
66 const std::string& provider = "")
67 {
68 return BlockCipher::create_or_throw(algo_spec, provider);
69 }
70
71BOTAN_DEPRECATED("Use BlockCipher::providers")
72inline std::vector<std::string> get_block_cipher_providers(const std::string& algo_spec)
73 {
74 return BlockCipher::providers(algo_spec);
75 }
76
77#endif
78
79#if defined(BOTAN_HAS_STREAM_CIPHER)
80
81/**
82* Stream cipher factory method.
83*
84* @param algo_spec the name of the desired stream cipher
85* @param provider the provider to use
86* @return pointer to the stream cipher object
87*/
88BOTAN_DEPRECATED("Use StreamCipher::create")
89inline StreamCipher* get_stream_cipher(const std::string& algo_spec,
90 const std::string& provider = "")
91 {
92 return StreamCipher::create(algo_spec, provider).release();
93 }
94
95BOTAN_DEPRECATED("Use StreamCipher::create_or_throw")
96inline std::unique_ptr<StreamCipher> make_stream_cipher(const std::string& algo_spec,
97 const std::string& provider = "")
98 {
99 return StreamCipher::create_or_throw(algo_spec, provider);
100 }
101
102BOTAN_DEPRECATED("Use StreamCipher::providers")
103inline std::vector<std::string> get_stream_cipher_providers(const std::string& algo_spec)
104 {
105 return StreamCipher::providers(algo_spec);
106 }
107
108#endif
109
110#if defined(BOTAN_HAS_HASH)
111
112/**
113* Hash function factory method.
114*
115* @param algo_spec the name of the desired hash function
116* @param provider the provider to use
117* @return pointer to the hash function object
118*/
119BOTAN_DEPRECATED("Use HashFunction::create")
120inline HashFunction* get_hash_function(const std::string& algo_spec,
121 const std::string& provider = "")
122 {
123 return HashFunction::create(algo_spec, provider).release();
124 }
125
126BOTAN_DEPRECATED("Use HashFunction::create_or_throw")
127inline std::unique_ptr<HashFunction> make_hash_function(const std::string& algo_spec,
128 const std::string& provider = "")
129 {
130 return HashFunction::create_or_throw(algo_spec, provider);
131 }
132
133BOTAN_DEPRECATED("Use HashFunction::create")
134inline HashFunction* get_hash(const std::string& algo_spec,
135 const std::string& provider = "")
136 {
137 return HashFunction::create(algo_spec, provider).release();
138 }
139
140BOTAN_DEPRECATED("Use HashFunction::providers")
141inline std::vector<std::string> get_hash_function_providers(const std::string& algo_spec)
142 {
143 return HashFunction::providers(algo_spec);
144 }
145
146#endif
147
148#if defined(BOTAN_HAS_MAC)
149/**
150* MAC factory method.
151*
152* @param algo_spec the name of the desired MAC
153* @param provider the provider to use
154* @return pointer to the MAC object
155*/
156BOTAN_DEPRECATED("MessageAuthenticationCode::create")
157inline MessageAuthenticationCode* get_mac(const std::string& algo_spec,
158 const std::string& provider = "")
159 {
160 return MessageAuthenticationCode::create(algo_spec, provider).release();
161 }
162
163BOTAN_DEPRECATED("MessageAuthenticationCode::create_or_throw")
164inline std::unique_ptr<MessageAuthenticationCode> make_message_auth(const std::string& algo_spec,
165 const std::string& provider = "")
166 {
167 return MessageAuthenticationCode::create(algo_spec, provider);
168 }
169
170BOTAN_DEPRECATED("MessageAuthenticationCode::providers")
171inline std::vector<std::string> get_mac_providers(const std::string& algo_spec)
172 {
173 return MessageAuthenticationCode::providers(algo_spec);
174 }
175#endif
176
177}
178
179#endif
Botan::BlockCipher::providers
static std::vector< std::string > providers(const std::string &algo_spec)
Definition: block_cipher.cpp:343
Botan::BlockCipher::create
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
Definition: block_cipher.cpp:104
Botan::BlockCipher::create_or_throw
static std::unique_ptr< BlockCipher > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: block_cipher.cpp:333
Botan::HashFunction::providers
static std::vector< std::string > providers(const std::string &algo_spec)
Definition: hash.cpp:339
Botan::HashFunction::create_or_throw
static std::unique_ptr< HashFunction > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:329
Botan::HashFunction::create
static std::unique_ptr< HashFunction > create(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:102
Botan::MessageAuthenticationCode::providers
static std::vector< std::string > providers(const std::string &algo_spec)
Definition: mac.cpp:132
Botan::MessageAuthenticationCode::create
static std::unique_ptr< MessageAuthenticationCode > create(const std::string &algo_spec, const std::string &provider="")
Definition: mac.cpp:46
Botan::StreamCipher::providers
static std::vector< std::string > providers(const std::string &algo_spec)
Definition: stream_cipher.cpp:133
Botan::StreamCipher::create
static std::unique_ptr< StreamCipher > create(const std::string &algo_spec, const std::string &provider="")
Definition: stream_cipher.cpp:38
Botan::StreamCipher::create_or_throw
static std::unique_ptr< StreamCipher > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: stream_cipher.cpp:123
BOTAN_DEPRECATED_HEADER
#define BOTAN_DEPRECATED_HEADER(hdr)
Definition: compiler.h:132
Botan::OIDS::lookup
std::string lookup(const OID &oid)
Definition: oids.h:71
Botan
Definition: alg_id.cpp:13
std
Definition: bigint.h:1155