work in progress on setting up tls connections to rabbitmq
This commit is contained in:
parent
e39ca5b012
commit
c26005ddfb
|
|
@ -74,7 +74,7 @@ int main()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make a connection
|
// make a connection
|
||||||
AMQP::Address address("amqp://guest:guest@localhost/");
|
AMQP::Address address("amqps://guest:guest@testmailsender1.copernica.nl/");
|
||||||
AMQP::TcpConnection connection(&handler, address);
|
AMQP::TcpConnection connection(&handler, address);
|
||||||
|
|
||||||
// we need a channel too
|
// we need a channel too
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,23 @@ long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg)
|
||||||
// call the openssl function
|
// call the openssl function
|
||||||
return func(ssl, cmd, larg, parg);
|
return func(ssl, cmd, larg, parg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the certificate file to be used by the connection
|
||||||
|
* @param ssl ssl structure
|
||||||
|
* @param file filename
|
||||||
|
* @param type type of file
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
int SSL_use_certificate_file(SSL *ssl, const char *file, int type)
|
||||||
|
{
|
||||||
|
// create a function
|
||||||
|
static Function<decltype(::SSL_use_certificate_file)> func("SSL_use_certificate_file");
|
||||||
|
|
||||||
|
// call the openssl function
|
||||||
|
return func(ssl, file, type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of namespace
|
* End of namespace
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ int SSL_shutdown(SSL *ssl);
|
||||||
int SSL_set_fd(SSL *ssl, int fd);
|
int SSL_set_fd(SSL *ssl, int fd);
|
||||||
int SSL_get_shutdown(const SSL *ssl);
|
int SSL_get_shutdown(const SSL *ssl);
|
||||||
int SSL_get_error(const SSL *ssl, int ret);
|
int SSL_get_error(const SSL *ssl, int ret);
|
||||||
|
int SSL_use_certificate_file(SSL *ssl, const char *file, int type);
|
||||||
void SSL_set_connect_state(SSL *ssl);
|
void SSL_set_connect_state(SSL *ssl);
|
||||||
void SSL_CTX_free(SSL_CTX *ctx);
|
void SSL_CTX_free(SSL_CTX *ctx);
|
||||||
void SSL_free(SSL *ssl);
|
void SSL_free(SSL *ssl);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ private:
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param method
|
* @param method the connect method to use
|
||||||
* @throws std::runtime_error
|
* @throws std::runtime_error
|
||||||
*/
|
*/
|
||||||
SslContext(const SSL_METHOD *method) : _ctx(OpenSSL::SSL_CTX_new(method))
|
SslContext(const SSL_METHOD *method) : _ctx(OpenSSL::SSL_CTX_new(method))
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param ctx
|
* @param ctx
|
||||||
|
* @param file
|
||||||
*/
|
*/
|
||||||
SslWrapper(SSL_CTX *ctx) : _ssl(OpenSSL::SSL_new(ctx))
|
SslWrapper(SSL_CTX *ctx) : _ssl(OpenSSL::SSL_new(ctx))
|
||||||
{
|
{
|
||||||
// report error
|
// report error
|
||||||
if (_ssl == nullptr) throw std::runtime_error("failed to construct ssl structure");
|
if (_ssl == nullptr) throw std::runtime_error("failed to construct ssl structure");
|
||||||
|
|
||||||
|
//OpenSSL::SSL_use_certificate_file(_ssl, "cert.pem", SSL_FILETYPE_PEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue