diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2012-12-26 16:23:36 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2012-12-26 16:23:36 +0000 |
commit | 2001129f096d10bbd815936d23af3e97daf7882d (patch) | |
tree | ce53c1f0ec0522abde68dcc6a2dbf612bbf132bd /apps/s_cb.c | |
parent | a50ecaee56e8e2ebf14ed122d15578acd2a2aa06 (diff) |
new ctrl to retrive value of received temporary key in server key exchange message, print out details in s_client
(backport from HEAD)
Diffstat (limited to 'apps/s_cb.c')
-rw-r--r-- | apps/s_cb.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c index b592870f96..fc40f391e3 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -466,6 +466,40 @@ int ssl_print_curves(BIO *out, SSL *s) return 1; } +int ssl_print_tmp_key(BIO *out, SSL *s) + { + EVP_PKEY *key; + if (!SSL_get_server_tmp_key(s, &key)) + return 1; + BIO_puts(out, "Server Temp Key: "); + switch (EVP_PKEY_id(key)) + { + case EVP_PKEY_RSA: + BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_bits(key)); + break; + + case EVP_PKEY_DH: + BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(key)); + break; + + case EVP_PKEY_EC: + { + EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); + int nid; + const char *cname; + nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); + EC_KEY_free(ec); + cname = EC_curve_nid2nist(nid); + if (!cname) + cname = OBJ_nid2sn(nid); + BIO_printf(out, "ECDH, %s, %d bits\n", + cname, EVP_PKEY_bits(key)); + } + } + EVP_PKEY_free(key); + return 1; + } + long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret) |