diff --git a/contrib/sslinfo/sslinfo.c b/contrib/sslinfo/sslinfo.c
index 8482cfa..6c7d936 100644
--- a/contrib/sslinfo/sslinfo.c
+++ b/contrib/sslinfo/sslinfo.c
@@ -23,6 +23,8 @@ PG_MODULE_MAGIC;
Datum ssl_is_used(PG_FUNCTION_ARGS);
+Datum ssl_version(PG_FUNCTION_ARGS);
+Datum ssl_cipher(PG_FUNCTION_ARGS);
Datum ssl_client_cert_present(PG_FUNCTION_ARGS);
Datum ssl_client_serial(PG_FUNCTION_ARGS);
Datum ssl_client_dn_field(PG_FUNCTION_ARGS);
@@ -49,6 +51,32 @@ ssl_is_used(PG_FUNCTION_ARGS)
/*
+ * Returns SSL cipher currently in use.
+ */
+PG_FUNCTION_INFO_V1(ssl_veresion);
+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)));
+}
+
+
+/*
+ * Returns SSL cipher currently in use.
+ */
+PG_FUNCTION_INFO_V1(ssl_cipher);
+Datum
+ssl_cipher(PG_FUNCTION_ARGS)
+{
+ if (MyProcPort->ssl == NULL)
+ PG_RETURN_NULL();
+ PG_RETURN_TEXT_P(cstring_to_text(SSL_get_cipher(MyProcPort->ssl)));
+}
+
+
+/*
* Indicates whether current client have provided a certificate
*
* Function has no arguments. Returns bool. True if current session
diff --git a/contrib/sslinfo/sslinfo.sql.in b/contrib/sslinfo/sslinfo.sql.in
index 705fd74..1353dab 100644
--- a/contrib/sslinfo/sslinfo.sql.in
+++ b/contrib/sslinfo/sslinfo.sql.in
@@ -11,6 +11,14 @@ CREATE OR REPLACE FUNCTION ssl_is_used() RETURNS boolean
AS 'MODULE_PATHNAME', 'ssl_is_used'
LANGUAGE C STRICT;
+CREATE OR REPLACE FUNCTION ssl_version() RETURNS text
+AS 'MODULE_PATHNAME', 'ssl_version'
+LANGUAGE C STRICT;
+
+CREATE OR REPLACE FUNCTION ssl_cipher() RETURNS text
+AS 'MODULE_PATHNAME', 'ssl_cipher'
+LANGUAGE C STRICT;
+
CREATE OR REPLACE FUNCTION ssl_client_cert_present() RETURNS boolean
AS 'MODULE_PATHNAME', 'ssl_client_cert_present'
LANGUAGE C STRICT;
diff --git a/contrib/sslinfo/uninstall_sslinfo.sql b/contrib/sslinfo/uninstall_sslinfo.sql
index 5d2d9b3..1ea7bcc 100644
--- a/contrib/sslinfo/uninstall_sslinfo.sql
+++ b/contrib/sslinfo/uninstall_sslinfo.sql
@@ -5,6 +5,8 @@ SET search_path = public;
DROP FUNCTION ssl_client_serial();
DROP FUNCTION ssl_is_used();
+DROP FUNCTION ssl_cipher();
+DROP FUNCTION ssl_version();
DROP FUNCTION ssl_client_cert_present();
DROP FUNCTION ssl_client_dn_field(text);
DROP FUNCTION ssl_issuer_field(text);
diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml
index 2f71af9..39c5e75 100644
--- a/doc/src/sgml/sslinfo.sgml
+++ b/doc/src/sgml/sslinfo.sgml
@@ -37,6 +37,30 @@ ssl_is_used() returns boolean
+ssl_version() returns text
+
+
+
+ Returns the name of the protocol used for the SSL connection (e.g. SSLv2,
+ SSLv3, or TLSv1).
+
+
+
+
+
+
+ssl_cipher() returns text
+
+
+
+ Returns the name of the cipher used for the SSL connection
+ (e.g. DHE-RSA-AES256-SHA).
+
+
+
+
+
+
ssl_client_cert_present() returns boolean