Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

openssl.h
Go to the documentation of this file.
1 /*
2 * Utils for calling OpenSSL
3 * (C) 2015,2016 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_INTERNAL_OPENSSL_H__
9 #define BOTAN_INTERNAL_OPENSSL_H__
10
11 #include <botan/pk_ops_fwd.h>
12 #include <botan/secmem.h>
13 #include <botan/exceptn.h>
14 #include <memory>
15 #include <string>
16
17 #include <openssl/err.h>
18 #include <openssl/evp.h>
19
20 #if defined(BOTAN_HAS_RC4)
21 #include <openssl/rc4.h>
22 #endif
23
24 namespace Botan {
25
26 class BlockCipher;
27 class StreamCipher;
28 class HashFunction;
29
30 class OpenSSL_Error : public Exception
31 {
32 public:
33 OpenSSL_Error(const std::string& what) :
34 Exception(what + " failed: " + ERR_error_string(ERR_get_error(), nullptr)) {}
35 };
36
37 /* Block Ciphers */
38
39 std::unique_ptr<BlockCipher>
40 make_openssl_block_cipher(const std::string& name);
41
42 /* Hash */
43
44 std::unique_ptr<HashFunction>
45 make_openssl_hash(const std::string& name);
46
47 /* RSA */
48
49 #if defined(BOTAN_HAS_RSA)
50
51 class RSA_PublicKey;
52 class RSA_PrivateKey;
53
54 std::unique_ptr<PK_Ops::Encryption>
55 make_openssl_rsa_enc_op(const RSA_PublicKey& key, const std::string& params);
56 std::unique_ptr<PK_Ops::Decryption>
57 make_openssl_rsa_dec_op(const RSA_PrivateKey& key, const std::string& params);
58
59 std::unique_ptr<PK_Ops::Verification>
60 make_openssl_rsa_ver_op(const RSA_PublicKey& key, const std::string& params);
61 std::unique_ptr<PK_Ops::Signature>
62 make_openssl_rsa_sig_op(const RSA_PrivateKey& key, const std::string& params);
63
64 #endif
65
66 /* ECDSA */
67
68 #if defined(BOTAN_HAS_ECDSA)
69
70 class ECDSA_PublicKey;
71 class ECDSA_PrivateKey;
72
73 std::unique_ptr<PK_Ops::Verification>
74 make_openssl_ecdsa_ver_op(const ECDSA_PublicKey& key, const std::string& params);
75 std::unique_ptr<PK_Ops::Signature>
76 make_openssl_ecdsa_sig_op(const ECDSA_PrivateKey& key, const std::string& params);
77
78 #endif
79
80 /* ECDH */
81
82 #if defined(BOTAN_HAS_ECDH)
83
84 class ECDH_PrivateKey;
85
86 std::unique_ptr<PK_Ops::Key_Agreement>
87 make_openssl_ecdh_ka_op(const ECDH_PrivateKey& key, const std::string& params);
88
89 #endif
90
91 #if defined(BOTAN_HAS_RC4)
92
93 std::unique_ptr<StreamCipher>
94 make_openssl_rc4(size_t skip);
95
96 #endif
97
98 }
99
100 #endif
Botan::Exception
Definition: exceptn.h:21
Botan::OpenSSL_Error::OpenSSL_Error
OpenSSL_Error(const std::string &what)
Definition: openssl.h:33
Botan::make_openssl_hash
std::unique_ptr< HashFunction > make_openssl_hash(const std::string &name)
Definition: openssl_hash.cpp:76
Botan::Exception::what
const char * what() const BOTAN_NOEXCEPT override
Definition: exceptn.h:26
Botan
Definition: alg_id.cpp:13
Botan::OpenSSL_Error
Definition: openssl.h:30
Botan::make_openssl_block_cipher
std::unique_ptr< BlockCipher > make_openssl_block_cipher(const std::string &name)
Definition: openssl_block.cpp:157