71 static int PKCS7_type_is_other(
PKCS7* p7)
99 if ( PKCS7_type_is_other(p7) && p7->
d.
other
142 unsigned char *
key,
int keylen)
146 unsigned char *ek = NULL;
200 static int pkcs7_decrypt_rinfo(
unsigned char **pek,
int *peklen,
204 unsigned char *ek = NULL;
281 md_sk=p7->
d.
sign->md_algs;
289 if (evp_cipher == NULL)
300 if (evp_cipher == NULL)
322 if (xa && !PKCS7_bio_add_digest(&out, xa))
325 if (evp_cipher != NULL)
365 if (pkcs7_encode_rinfo(ri, key, keylen) <= 0)
381 else if (os && os->
length > 0)
423 BIO *
out=NULL,*btmp=NULL,*etmp=NULL,*bio=NULL;
433 unsigned char *ek = NULL, *tkey = NULL;
434 int eklen = 0, tkeylen = 0;
443 md_sk=p7->
d.
sign->md_algs;
451 if (evp_cipher == NULL)
462 if (evp_cipher == NULL)
502 if (evp_cipher != NULL)
531 if (!pkcs7_cmp_ri(ri, pcert))
554 if (pkcs7_decrypt_rinfo(&ek, &eklen,
563 if (pkcs7_decrypt_rinfo(&ek, &eklen, ri, pkey) < 0)
642 if (data_body->
length > 0)
645 if (data_body->
length > 0)
789 si_sk=p7->
d.
sign->signer_info;
818 if (si->
pkey == NULL)
825 btmp = PKCS7_find_digest(&mdc, btmp, j);
841 if (!do_pkcs7_signed_attrib(si, &ctx_tmp))
846 unsigned char *abuf = NULL;
847 unsigned int abuflen;
868 if (!PKCS7_find_digest(&mdc, bio,
904 unsigned char *abuf = NULL;
970 cert=p7->
d.
sign->cert;
1039 if ((btmp == NULL) ||
1072 unsigned int md_len;
1079 if (!message_digest)
1085 if ((message_digest->
length != (
int)md_len) ||
1086 (memcmp(message_digest->
data,md_dat,md_len)))
1091 for (ii=0; ii<message_digest->
length; ii++)
1092 printf(
"%02X",message_digest->
data[ii]); printf(
" sent\n");
1093 for (ii=0; ii<md_len; ii++) printf(
"%02X",md_dat[ii]); printf(
" calc\n");
1165 return(get_attribute(si->auth_attr,nid));
1170 return(get_attribute(si->unauth_attr,nid));
1180 if (!o || !sk)
return(NULL);
1207 if (p7si->auth_attr != NULL)
1210 if (p7si->auth_attr == NULL)
1226 if (p7si->unauth_attr != NULL)
1228 X509_ATTRIBUTE_free);
1230 if (p7si->unauth_attr == NULL)
1245 return(add_attribute(&(p7si->auth_attr),nid,atrtype,value));
1251 return(add_attribute(&(p7si->unauth_attr),nid,atrtype,value));
1269 X509_ATTRIBUTE_free(attr);
1282 X509_ATTRIBUTE_free(attr);
1288 X509_ATTRIBUTE_free(attr);