65 #include <sys/types.h>
74 static int add_certs_from_file(
STACK_OF(
X509) *stack,
char *certfile);
76 #define PROG crl2pkcs7_main
84 int MAIN(
int,
char **);
86 int MAIN(
int argc,
char **argv)
90 int informat,outformat;
91 char *infile,*outfile,*prog,*certfile;
116 if (strcmp(*argv,
"-inform") == 0)
118 if (--argc < 1)
goto bad;
121 else if (strcmp(*argv,
"-outform") == 0)
123 if (--argc < 1)
goto bad;
126 else if (strcmp(*argv,
"-in") == 0)
128 if (--argc < 1)
goto bad;
131 else if (strcmp(*argv,
"-nocrl") == 0)
135 else if (strcmp(*argv,
"-out") == 0)
137 if (--argc < 1)
goto bad;
140 else if (strcmp(*argv,
"-certfile") == 0)
142 if (--argc < 1)
goto bad;
165 BIO_printf(
bio_err,
" -certfile arg certificates file of chain to a trusted CA\n");
176 if ((in == NULL) || (out == NULL))
198 crl=PEM_read_bio_X509_CRL(in,NULL,NULL,NULL);
211 if ((p7=PKCS7_new()) == NULL)
goto end;
212 if ((p7s=PKCS7_SIGNED_new()) == NULL)
goto end;
227 p7s->cert=cert_stack;
231 if (add_certs_from_file(cert_stack,certfile) < 0)
244 #ifdef OPENSSL_SYS_VMS
263 i=PEM_write_bio_PKCS7(out,p7);
278 if (p7 != NULL) PKCS7_free(p7);
279 if (crl != NULL) X509_CRL_free(crl);
295 static int add_certs_from_file(
STACK_OF(
X509) *stack,
char *certfile)
311 sk=PEM_X509_INFO_read_bio(in,NULL,NULL,NULL);
321 if (xi->
x509 != NULL)