本文整理汇总了C++中SSL_get_version函数的典型用法代码示例。如果您正苦于以下问题:C++ SSL_get_version函数的具体用法?C++ SSL_get_version怎么用?C++ SSL_get_version使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SSL_get_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sock_make_secure
int sock_make_secure(nsocket *sock, nssl_context *ctx)
{
#ifdef ENABLE_SSL
int ret;
SSL_CTX *ssl_ctx;
if (ctx) {
ssl_ctx = ctx->ctx;
} else {
ssl_ctx = sock->default_ctx;
}
sock->ssl = SSL_new(ssl_ctx);
if (!sock->ssl) {
sock->error = ERROR_SSL_STRING;
/* Usually goes wrong because: */
fprintf(stderr, "Have you called sock_init()!?\n");
return SOCK_ERROR;
}
SSL_set_fd(sock->ssl, sock->fd);
ret = SSL_connect(sock->ssl);
if (ret == -1) {
sock->error = ERROR_SSL_STRING;
SSL_free(sock->ssl);
sock->ssl = NULL;
return SOCK_ERROR;
}
#if 0
/* Tommi Komulainen <[email protected]> has donated his SSL
* cert verification from the mutt IMAP/SSL code under the
* LGPL... it will plug in here */
ret = sock_check_certicate(sock);
if (ret) {
SSL_shutdown(sock->ssl);
SSL_free(sock->ssl);
sock->ssl = NULL;
return ret;
}
#endif
if (notify_cb) (*notify_cb)(notify_ud, sock_secure_details,
SSL_get_version(sock->ssl));
DEBUG(DEBUG_SOCKET, "SSL connected: version %s\n",
SSL_get_version(sock->ssl));
return 0;
#else
sock->error = _("This application does not have SSL support.");
return SOCK_ERROR;
#endif
}
示例2: ssl_version
Datum
ssl_version(PG_FUNCTION_ARGS)
{
if (MyProcPort->ssl == NULL)
PG_RETURN_NULL();
PG_RETURN_TEXT_P(cstring_to_text(SSL_get_version(MyProcPort->ssl)));
}
示例3: get_version
static int get_version(str* res, sip_msg_t* msg)
{
str version;
static char buf[1024];
struct tcp_connection* c;
SSL* ssl;
c = get_cur_connection(msg);
if (!c) {
INFO("TLS connection not found in select_version\n");
goto err;
}
ssl = get_ssl(c);
if (!ssl) goto err;
version.s = (char*)SSL_get_version(ssl);
version.len = version.s ? strlen(version.s) : 0;
if (version.len >= 1024) {
ERR("Version string too long\n");
goto err;
}
memcpy(buf, version.s, version.len);
res->s = buf;
res->len = version.len;
tcpconn_put(c);
return 0;
err:
if (c) tcpconn_put(c);
return -1;
}
示例4: openssl_iostream_get_security_string
static const char *
openssl_iostream_get_security_string(struct ssl_iostream *ssl_io)
{
const SSL_CIPHER *cipher;
#ifdef HAVE_SSL_COMPRESSION
const COMP_METHOD *comp;
#endif
const char *comp_str;
int bits, alg_bits;
if (!ssl_io->handshaked)
return "";
cipher = SSL_get_current_cipher(ssl_io->ssl);
bits = SSL_CIPHER_get_bits(cipher, &alg_bits);
#ifdef HAVE_SSL_COMPRESSION
comp = SSL_get_current_compression(ssl_io->ssl);
comp_str = comp == NULL ? "" :
t_strconcat(" ", SSL_COMP_get_name(comp), NULL);
#else
comp_str = "";
#endif
return t_strdup_printf("%s with cipher %s (%d/%d bits)%s",
SSL_get_version(ssl_io->ssl),
SSL_CIPHER_get_name(cipher),
bits, alg_bits, comp_str);
}
示例5: io_strio
const char*
io_strio(struct io *io)
{
static char buf[128];
char ssl[128];
ssl[0] = '\0';
#ifdef IO_SSL
if (io->ssl) {
(void)snprintf(ssl, sizeof ssl, " ssl=%s:%s:%d",
SSL_get_version(io->ssl),
SSL_get_cipher_name(io->ssl),
SSL_get_cipher_bits(io->ssl, NULL));
}
#endif
if (io->iobuf == NULL)
(void)snprintf(buf, sizeof buf,
"<io:%p fd=%d to=%d fl=%s%s>",
io, io->sock, io->timeout, io_strflags(io->flags), ssl);
else
(void)snprintf(buf, sizeof buf,
"<io:%p fd=%d to=%d fl=%s%s ib=%zu ob=%zu>",
io, io->sock, io->timeout, io_strflags(io->flags), ssl,
io_pending(io), io_queued(io));
return (buf);
}
示例6: tls_get_conninfo
int
tls_get_conninfo(struct tls *ctx) {
const char * tmp;
tls_free_conninfo(ctx->conninfo);
if (ctx->ssl_peer_cert != NULL) {
if (tls_get_peer_cert_hash(ctx, &ctx->conninfo->hash) == -1)
goto err;
if (tls_get_peer_cert_subject(ctx, &ctx->conninfo->subject)
== -1)
goto err;
if (tls_get_peer_cert_issuer(ctx, &ctx->conninfo->issuer) == -1)
goto err;
if (tls_get_peer_cert_times(ctx, &ctx->conninfo->notbefore,
&ctx->conninfo->notafter) == -1)
goto err;
}
if ((tmp = SSL_get_version(ctx->ssl_conn)) == NULL)
goto err;
ctx->conninfo->version = strdup(tmp);
if (ctx->conninfo->version == NULL)
goto err;
if ((tmp = SSL_get_cipher(ctx->ssl_conn)) == NULL)
goto err;
ctx->conninfo->cipher = strdup(tmp);
if (ctx->conninfo->cipher == NULL)
goto err;
return (0);
err:
tls_free_conninfo(ctx->conninfo);
return (-1);
}
示例7: sslLogCallback
/**
* Callback used for debugging
*/
static void sslLogCallback(const SSL *ssl, int where, int ret) {
const char *retstr = "";
int should_log = 1;
/* Ignore low-level SSL stuff */
if (where & SSL_CB_ALERT) {
should_log = 1;
}
if (where == SSL_CB_HANDSHAKE_START || where == SSL_CB_HANDSHAKE_DONE) {
should_log = 1;
}
if ((where & SSL_CB_EXIT) && ret == 0) {
should_log = 1;
}
if (!should_log) {
return;
}
retstr = SSL_alert_type_string(ret);
printf("ST(0x%x). %s. R(0x%x)%s\n", where, SSL_state_string_long(ssl), ret, retstr);
if (where == SSL_CB_HANDSHAKE_DONE) {
printf("Using SSL version %s. Cipher=%s\n", SSL_get_version(ssl), SSL_get_cipher_name(ssl));
}
}
示例8: ssl_version
datum_t
ssl_version(PG_FUNC_ARGS)
{
if (proc_port->ssl == NULL)
RET_NULL();
RET_TEXT_P(cstring_to_text(SSL_get_version(proc_port->ssl)));
}
示例9: be_tls_get_version
const char *
be_tls_get_version(Port *port)
{
if (port->ssl)
return SSL_get_version(port->ssl);
else
return NULL;
}
示例10: be_tls_get_version
void
be_tls_get_version(Port *port, char *ptr, size_t len)
{
if (port->ssl)
strlcpy(ptr, SSL_get_version(port->ssl), len);
else
ptr[0] = '\0';
}
示例11: SSL_get_cipher_name
std::string SSLSocket::getEncryptionInfo() const noexcept {
if (!ssl)
return Util::emptyString;
string cipher = SSL_get_cipher_name(ssl);
string protocol = SSL_get_version(ssl);
return protocol + " / " + cipher;
}
示例12: set_cipher_info
static void set_cipher_info(TLS_REC *tls, SSL *ssl)
{
g_return_if_fail(tls != NULL);
g_return_if_fail(ssl != NULL);
tls_rec_set_protocol_version(tls, SSL_get_version(ssl));
tls_rec_set_cipher(tls, SSL_CIPHER_get_name(SSL_get_current_cipher(ssl)));
tls_rec_set_cipher_size(tls, SSL_get_cipher_bits(ssl, NULL));
}
示例13: describeConnection
void describeConnection(SSL* ssl)
{
char buff[128];
const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
CHECK(cipher != NULL);
char *desc = SSL_CIPHER_description(cipher,buff,128);
CHECK(desc != NULL);
fprintf(stderr,"renegotiation: %s\n",
SSL_get_secure_renegotiation_support(ssl)?"allowed":"disallowed");
fprintf(stderr,"%s: %s", SSL_get_version(ssl), desc);
}
示例14: ssl_to_text
const char *
ssl_to_text(const SSL *ssl)
{
static char buf[256];
(void)snprintf(buf, sizeof buf, "version=%s, cipher=%s, bits=%d",
SSL_get_version(ssl),
SSL_get_cipher_name(ssl),
SSL_get_cipher_bits(ssl, NULL));
return (buf);
}
示例15: SSL_get_cipher_name
CipherInfo
TCPConnection::GetCipherInfo()
{
if (!is_ssl_)
{
throw std::logic_error("Session is not SSL/TLS. Cipher info cannot be retrieved.");
}
auto ssl_handle = ssl_socket_.native_handle();
AnsiString name = SSL_get_cipher_name(ssl_handle);
AnsiString version = SSL_get_version(ssl_handle);
int bits = SSL_get_cipher_bits(ssl_handle, 0);
return CipherInfo(name, version, bits);
}