/usr/include/proton/ssl.hpp is in libqpid-proton-cpp8-dev 0.14.0-5.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | #ifndef PROTON_SSL_HPP
#define PROTON_SSL_HPP
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include "./internal/export.hpp"
#include "./internal/object.hpp"
#include <proton/ssl.h>
#include <string>
namespace proton {
class connection_options;
/// SSL information.
class ssl {
/// @cond INTERNAL
ssl(pn_ssl_t* s) : object_(s) {}
/// @endcond
public:
/// Create an empty ssl object.
ssl() : object_(0) {}
/// Determines the level of peer validation.
enum verify_mode {
/// Require peer to provide a valid identifying certificate
VERIFY_PEER = PN_SSL_VERIFY_PEER,
/// Do not require a certificate or cipher authorization
ANONYMOUS_PEER = PN_SSL_ANONYMOUS_PEER,
/// Require valid certificate and matching name
VERIFY_PEER_NAME = PN_SSL_VERIFY_PEER_NAME
};
/// Outcome specifier for an attempted session resume.
enum resume_status {
UNKNOWN = PN_SSL_RESUME_UNKNOWN, ///< Session resume state unknown or not supported
NEW = PN_SSL_RESUME_NEW, ///< Session renegotiated, not resumed
REUSED = PN_SSL_RESUME_REUSED ///< Session resumed from previous session
};
/// @cond INTERNAL
/// XXX C API uses cipher_name
/// Get the cipher name.
PN_CPP_EXTERN std::string cipher() const;
/// XXX C API uses protocol_name
/// Get the protocol name.
PN_CPP_EXTERN std::string protocol() const;
/// Get the security strength factor.
PN_CPP_EXTERN int ssf() const;
/// XXX discuss, what's the meaning of "remote" here?
PN_CPP_EXTERN std::string remote_subject() const;
/// XXX setters? versus connection options
PN_CPP_EXTERN void resume_session_id(const std::string& session_id);
PN_CPP_EXTERN enum resume_status resume_status() const;
/// @endcond
private:
pn_ssl_t* object_;
/// @cond INTERNAL
friend class internal::factory<ssl>;
/// @endcond
};
/// **Experimental** - An SSL certificate.
class ssl_certificate {
public:
/// Create an SSL certificate.
PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main);
// XXX Document the following constructors
/// @copydoc ssl_certificate
PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main, const std::string &certdb_extra);
/// @copydoc ssl_certificate
PN_CPP_EXTERN ssl_certificate(const std::string &certdb_main, const std::string &certdb_extra, const std::string &passwd);
/// @endcond
private:
std::string certdb_main_;
std::string certdb_extra_;
std::string passwd_;
bool pw_set_;
/// @cond INTERNAL
friend class ssl_client_options;
friend class ssl_server_options;
/// @endcond
};
class ssl_domain_impl;
namespace internal {
// Base class for SSL configuration
class ssl_domain {
public:
PN_CPP_EXTERN ssl_domain(const ssl_domain&);
PN_CPP_EXTERN ssl_domain& operator=(const ssl_domain&);
PN_CPP_EXTERN ~ssl_domain();
protected:
ssl_domain(bool is_server);
pn_ssl_domain_t *pn_domain();
private:
ssl_domain_impl *impl_;
bool server_type_;
};
}
/// **Experimental** - SSL configuration for inbound connections.
class ssl_server_options : private internal::ssl_domain {
public:
/// Server SSL options based on the supplied X.509 certificate
/// specifier.
PN_CPP_EXTERN ssl_server_options(ssl_certificate &cert);
/// Server SSL options requiring connecting clients to provide a
/// client certificate.
PN_CPP_EXTERN ssl_server_options(ssl_certificate &cert, const std::string &trust_db,
const std::string &advertise_db = std::string(),
enum ssl::verify_mode mode = ssl::VERIFY_PEER);
/// Server SSL options restricted to available anonymous cipher
/// suites on the platform.
PN_CPP_EXTERN ssl_server_options();
private:
// Bring pn_domain into scope and allow connection_options to use
// it.
using internal::ssl_domain::pn_domain;
/// @cond INTERNAL
friend class connection_options;
/// @endcond
};
/// **Experimental** - SSL configuration for outbound connections.
class ssl_client_options : private internal::ssl_domain {
public:
/// Create SSL client options (no client certificate).
PN_CPP_EXTERN ssl_client_options(const std::string &trust_db,
enum ssl::verify_mode = ssl::VERIFY_PEER_NAME);
/// Create SSL client options with a client certificate.
PN_CPP_EXTERN ssl_client_options(ssl_certificate&, const std::string &trust_db,
enum ssl::verify_mode = ssl::VERIFY_PEER_NAME);
/// SSL connections restricted to available anonymous cipher
/// suites on the platform.
PN_CPP_EXTERN ssl_client_options();
private:
// Bring pn_domain into scope and allow connection_options to use
// it.
using internal::ssl_domain::pn_domain;
/// @cond INTERNAL
friend class connection_options;
/// @endcond
};
} // proton
#endif // PROTON_SSL_HPP
|