70 #define PROG sess_id_main
72 static const char *sess_id_usage[]={
73 "usage: sess_id args\n",
75 " -inform arg - input format - default PEM (DER or PEM)\n",
76 " -outform arg - output format - default PEM\n",
77 " -in arg - input file - default stdin\n",
78 " -out arg - output file - default stdout\n",
79 " -text - print ssl session id details\n",
80 " -cert - output certificate \n",
81 " -noout - no CRL output\n",
82 " -context arg - set the session ID context\n",
88 int MAIN(
int,
char **);
90 int MAIN(
int argc,
char **argv)
94 int ret=1,i,
num,badops=0;
96 int informat,outformat;
97 char *infile=NULL,*outfile=NULL,*context=NULL;
98 int cert=0,noout=0,
text=0;
115 if (strcmp(*argv,
"-inform") == 0)
117 if (--argc < 1)
goto bad;
120 else if (strcmp(*argv,
"-outform") == 0)
122 if (--argc < 1)
goto bad;
125 else if (strcmp(*argv,
"-in") == 0)
127 if (--argc < 1)
goto bad;
130 else if (strcmp(*argv,
"-out") == 0)
132 if (--argc < 1)
goto bad;
135 else if (strcmp(*argv,
"-text") == 0)
137 else if (strcmp(*argv,
"-cert") == 0)
139 else if (strcmp(*argv,
"-noout") == 0)
141 else if (strcmp(*argv,
"-context") == 0)
143 if(--argc < 1)
goto bad;
159 for (pp=sess_id_usage; (*pp != NULL); pp++)
165 x=load_sess_id(infile,informat);
166 if (x == NULL) {
goto end; }
171 size_t ctx_len = strlen(context);
184 char buf[1024*10],*
p;
213 #ifdef OPENSSL_SYS_VMS
237 BIO_puts(out,
"No certificate present\n");
248 i=PEM_write_bio_SSL_SESSION(out,x);
258 else if (!noout && (peer != NULL))
263 i=PEM_write_bio_X509(out,peer);
306 x=PEM_read_bio_SSL_SESSION(in,NULL,NULL,NULL);