*/
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
int argc;
char *argv[];
{
- char *keyfile;
+ char *keyfile=NULL;
BIO *in;
EVP_PKEY *pkey;
X509 *x509;
char buf[1024*4];
unsigned char *pp;
int i,printit=0;
- STACK *sk;
+ STACK_OF(PKCS7_SIGNER_INFO) *sk;
- SSLeay_add_all_algorithms();
+ OpenSSL_add_all_algorithms();
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
data=BIO_new(BIO_s_file());
}
if ((in=BIO_new_file(keyfile,"r")) == NULL) goto err;
- if ((x509=PEM_read_bio_X509(in,NULL,NULL)) == NULL) goto err;
+ if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err;
BIO_reset(in);
- if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err;
+ if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL)
+ goto err;
BIO_free(in);
if (pp == NULL)
/* Load the PKCS7 object from a file */
- if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL)) == NULL) goto err;
+ if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err;
/* We need to process the data */
/* We cannot support detached encryption */
p7bio=PKCS7_dataDecode(p7,pkey,detached,x509);
-
+
if (p7bio == NULL)
{
printf("problems decoding\n");
/* Ok, first we need to, for each subject entry,
* see if we can verify */
ERR_clear_error();
- for (i=0; i<sk_num(sk); i++)
+ for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++)
{
- si=(PKCS7_SIGNER_INFO *)sk_value(sk,i);
+ si=sk_PKCS7_SIGNER_INFO_value(sk,i);
i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si);
if (i <= 0)
goto err;