Ice 3.7 C++11 API Reference
OpenSSL.h
Go to the documentation of this file.
1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICESSL_OPENSSL_H
6 #define ICESSL_OPENSSL_H
7 
8 #include <IceSSL/Plugin.h>
9 
10 #include <openssl/x509v3.h>
11 #include <openssl/pem.h>
12 
13 //
14 // Automatically link IceSSLOpenSSL[D|++11|++11D].lib with Visual C++
15 //
16 #if defined(_MSC_VER)
17 # if !defined(ICE_BUILDING_ICESSL_OPENSSL) && defined(ICESSL_OPENSSL_API_EXPORTS)
18 # define ICE_BUILDING_ICESSL_OPENSSL
19 # endif
20 
21 # if !defined(ICE_BUILDING_ICESSL_OPENSSL)
22 # pragma comment(lib, ICE_LIBNAME("IceSSLOpenSSL"))
23 # endif
24 #endif
25 
26 #ifndef ICESSL_OPENSSL_API
27 # if defined(ICE_STATIC_LIBS)
28 # define ICESSL_OPENSSL_API
29 # elif defined(ICESSL_OPENSSL_API_EXPORTS)
30 # define ICESSL_OPENSSL_API ICE_DECLSPEC_EXPORT
31 # else
32 # define ICESSL_OPENSSL_API ICE_DECLSPEC_IMPORT
33 # endif
34 #endif
35 
36 #if defined(_WIN32) && !defined(ICESSL_OPENSSL_API_EXPORTS)
37 
38 namespace Ice
39 {
40 
48 ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceSSLOpenSSL(bool loadOnInitialize = true);
49 
50 }
51 #endif
52 
53 namespace IceSSL
54 {
55 
56 namespace OpenSSL
57 {
58 
59 class Certificate;
61 
67 {
68 public:
69 
77  static CertificatePtr create(x509_st* cert);
78 
86  static CertificatePtr load(const std::string& file);
87 
94  static CertificatePtr decode(const std::string& cert);
95 
101  virtual x509_st* getCert() const = 0;
102 };
103 
109 {
110 public:
111 
116  virtual Ice::Long getOpenSSLVersion() const = 0;
117 
132  virtual void setContext(SSL_CTX* ctx) = 0;
133 
139  virtual SSL_CTX* getContext() = 0;
140 };
142 
143 } // OpenSSL namespace end
144 
145 } // IceSSL namespace end
146 
147 #endif
IceSSL::OpenSSL::Plugin::getOpenSSLVersion
virtual Ice::Long getOpenSSLVersion() const =0
Obtains the OpenSSL version number.
IceSSL::OpenSSL::CertificatePtr
::std::shared_ptr< Certificate > CertificatePtr
Definition: OpenSSL.h:60
IceSSL
Definition: ConnectionInfo.h:59
ICE_DEFINE_PTR
#define ICE_DEFINE_PTR(TPtr, T)
Definition: Config.h:359
IceSSL::Plugin
Represents the IceSSL plug-in object.
Definition: Plugin.h:665
IceSSL::OpenSSL::Plugin::setContext
virtual void setContext(SSL_CTX *ctx)=0
Establishes the OpenSSL context.
IceSSL::OpenSSL::Plugin::getContext
virtual SSL_CTX * getContext()=0
Obtains the SSL context.
ICESSL_OPENSSL_API
#define ICESSL_OPENSSL_API
Definition: OpenSSL.h:32
IceSSL::OpenSSL::Certificate::load
static CertificatePtr load(const std::string &file)
Load the certificate from a file.
IceSSL::OpenSSL::Certificate
Encapsulates an OpenSSL X.509 certificate.
Definition: OpenSSL.h:67
IceSSL::OpenSSL::PluginPtr
::std::shared_ptr< Plugin > PluginPtr
Definition: OpenSSL.h:141
IceSSL::OpenSSL::Certificate::create
static CertificatePtr create(x509_st *cert)
Construct a certificate using a native certificate.
ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT
#define ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT
Definition: RegisterPlugins.h:24
IceSSL::Certificate
This convenience class is a wrapper around a native certificate.
Definition: Plugin.h:412
Ice::Long
long long int Long
The mapping for the Slice long type.
Definition: Config.h:57
Ice
Definition: BuiltinSequences.h:56
IceSSL::OpenSSL::Plugin
Represents the IceSSL plug-in object.
Definition: OpenSSL.h:109
IceSSL::OpenSSL::Certificate::decode
static CertificatePtr decode(const std::string &cert)
Decode a certificate from a string that uses the PEM encoding format.
Plugin.h
IceSSL::OpenSSL::Certificate::getCert
virtual x509_st * getCert() const =0
Retrieve the native X509 certificate value wrapped by this object.