summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMartin Kaiser <lists@kaiser.cx>2014-05-24 00:02:24 +0100
committerMatt Caswell <matt@openssl.org>2014-05-24 00:02:24 +0100
commit189ae368d91d2c9de5ed1fa21e993f5c83fc4445 (patch)
tree63daed6505f8df3c1baef63a7c92e0d96fa3a9f2 /apps
parentdd36fce023a64d90058b8fefbd95dadaca98f9ca (diff)
Add an NSS output format to sess_id to export to export the session id and the master key in NSS keylog format. PR#3352
Diffstat (limited to 'apps')
-rw-r--r--apps/apps.c2
-rw-r--r--apps/apps.h1
-rw-r--r--apps/sess_id.c4
3 files changed, 6 insertions, 1 deletions
diff --git a/apps/apps.c b/apps/apps.c
index b82882aa0c..946884860f 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -263,6 +263,8 @@ int str2fmt(char *s)
return(FORMAT_ASN1);
else if ((*s == 'T') || (*s == 't'))
return(FORMAT_TEXT);
+ else if ((strcmp(s,"NSS") == 0) || (strcmp(s,"nss") == 0))
+ return(FORMAT_NSS);
else if ((*s == 'N') || (*s == 'n'))
return(FORMAT_NETSCAPE);
else if ((*s == 'S') || (*s == 's'))
diff --git a/apps/apps.h b/apps/apps.h
index 5f083d4097..b4a9b49ce7 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -363,6 +363,7 @@ void store_setup_crl_download(X509_STORE *st);
#define FORMAT_MSBLOB 11 /* MS Key blob format */
#define FORMAT_PVK 12 /* MS PVK file format */
#define FORMAT_HTTP 13 /* Download using HTTP */
+#define FORMAT_NSS 14 /* NSS keylog format */
#define EXT_COPY_NONE 0
#define EXT_COPY_ADD 1
diff --git a/apps/sess_id.c b/apps/sess_id.c
index b16686c26d..d4bf1afe2d 100644
--- a/apps/sess_id.c
+++ b/apps/sess_id.c
@@ -73,7 +73,7 @@ static const char *sess_id_usage[]={
"usage: sess_id args\n",
"\n",
" -inform arg - input format - default PEM (DER or PEM)\n",
-" -outform arg - output format - default PEM\n",
+" -outform arg - output format - default PEM (PEM, DER or NSS)\n",
" -in arg - input file - default stdin\n",
" -out arg - output file - default stdout\n",
" -text - print ssl session id details\n",
@@ -246,6 +246,8 @@ bad:
i=i2d_SSL_SESSION_bio(out,x);
else if (outformat == FORMAT_PEM)
i=PEM_write_bio_SSL_SESSION(out,x);
+ else if (outformat == FORMAT_NSS)
+ i=SSL_SESSION_print_keylog(out,x);
else {
BIO_printf(bio_err,"bad output format specified for outfile\n");
goto end;