summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL/PluginI.h
blob: 6cd7973047dcbba2db6c936437245484a4a20186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef ICESSL_PLUGIN_I_H
#define ICESSL_PLUGIN_I_H

#include <IceSSL/Plugin.h>
#include <IceSSL/SSLEngineF.h>
#include <IceSSL/ConnectionInfo.h>
#include <Ice/CommunicatorF.h>

namespace IceSSL
{

class ExtendedConnectionInfo : public ConnectionInfo
{
public:

    TrustError errorCode;
    std::string host;
};
ICE_DEFINE_PTR(ExtendedConnectionInfoPtr, ExtendedConnectionInfo);

// TODO: This class provides new certificate virtual methods that canot be added directly to the certificate class
// without breaking binary compatibility. The class can be removed once the relevant methods can be marked as virtual in
// the certificate class in the next major release (3.8.x).
class ICESSL_API CertificateExtendedInfo
{
public:

    virtual unsigned int getKeyUsage() const = 0;
    virtual unsigned int getExtendedKeyUsage() const = 0;
};

class ICESSL_API PluginI : public virtual IceSSL::Plugin
{
public:

    PluginI(const Ice::CommunicatorPtr&, const IceSSL::SSLEnginePtr&);
    //
    // From Ice::Plugin.
    //
    virtual void initialize();
    virtual void destroy();

    //
    // From IceSSL::Plugin.
    //
#ifdef ICE_CPP11_MAPPING
    virtual void setCertificateVerifier(std::function<bool(const std::shared_ptr<ConnectionInfo>&)>);
    virtual void setPasswordPrompt(std::function<std::string()>);
#else
    virtual void setCertificateVerifier(const CertificateVerifierPtr&);
    virtual void setPasswordPrompt(const PasswordPromptPtr&);
#endif

    virtual CertificatePtr load(const std::string&) const = 0;
    virtual CertificatePtr decode(const std::string&) const = 0;
protected:

    SSLEnginePtr _engine;
};

}

#endif