Lines Matching defs:p7

64 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
69 nid=OBJ_obj2nid(p7->type);
76 ret=p7->detached=(int)larg;
77 if (ret && PKCS7_type_is_data(p7->d.sign->contents))
80 os=p7->d.sign->contents->d.data;
82 p7->d.sign->contents->d.data = NULL;
94 if(!p7->d.sign || !p7->d.sign->contents->d.ptr)
98 p7->detached = ret;
114 int PKCS7_content_new(PKCS7 *p7, int type)
120 if (!PKCS7_set_content(p7,ret)) goto err;
128 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data)
132 i=OBJ_obj2nid(p7->type);
136 if (p7->d.sign->contents != NULL)
137 PKCS7_free(p7->d.sign->contents);
138 p7->d.sign->contents=p7_data;
141 if (p7->d.digest->contents != NULL)
142 PKCS7_free(p7->d.digest->contents);
143 p7->d.digest->contents=p7_data;
158 int PKCS7_set_type(PKCS7 *p7, int type)
162 /*PKCS7_content_free(p7);*/
168 p7->type=obj;
169 if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL)
171 if (!ASN1_INTEGER_set(p7->d.sign->version,1))
173 PKCS7_SIGNED_free(p7->d.sign);
174 p7->d.sign=NULL;
179 p7->type=obj;
180 if ((p7->d.data=M_ASN1_OCTET_STRING_new()) == NULL)
184 p7->type=obj;
185 if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new())
187 ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1);
188 if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1))
190 p7->d.signed_and_enveloped->enc_data->content_type
194 p7->type=obj;
195 if ((p7->d.enveloped=PKCS7_ENVELOPE_new())
197 if (!ASN1_INTEGER_set(p7->d.enveloped->version,0))
199 p7->d.enveloped->enc_data->content_type
203 p7->type=obj;
204 if ((p7->d.encrypted=PKCS7_ENCRYPT_new())
206 if (!ASN1_INTEGER_set(p7->d.encrypted->version,0))
208 p7->d.encrypted->enc_data->content_type
213 p7->type=obj;
214 if ((p7->d.digest=PKCS7_DIGEST_new())
216 if (!ASN1_INTEGER_set(p7->d.digest->version,0))
228 int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other)
230 p7->type = OBJ_nid2obj(type);
231 p7->d.other = other;
235 int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi)
242 i=OBJ_obj2nid(p7->type);
246 signer_sk= p7->d.sign->signer_info;
247 md_sk= p7->d.sign->md_algs;
250 signer_sk= p7->d.signed_and_enveloped->signer_info;
251 md_sk= p7->d.signed_and_enveloped->md_algs;
287 int PKCS7_add_certificate(PKCS7 *p7, X509 *x509)
292 i=OBJ_obj2nid(p7->type);
296 sk= &(p7->d.sign->cert);
299 sk= &(p7->d.signed_and_enveloped->cert);
313 int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
318 i=OBJ_obj2nid(p7->type);
322 sk= &(p7->d.sign->crl);
325 sk= &(p7->d.signed_and_enveloped->crl);
417 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey,
424 if (!PKCS7_add_signer(p7,si)) goto err;
430 int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md)
432 if (PKCS7_type_is_digest(p7))
434 if(!(p7->d.digest->md->parameter = ASN1_TYPE_new()))
439 p7->d.digest->md->parameter->type = V_ASN1_NULL;
440 p7->d.digest->md->algorithm = OBJ_nid2obj(EVP_MD_nid(md));
448 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
450 if (PKCS7_type_is_signed(p7))
452 return(p7->d.sign->signer_info);
454 else if (PKCS7_type_is_signedAndEnveloped(p7))
456 return(p7->d.signed_and_enveloped->signer_info);
462 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509)
468 if (!PKCS7_add_recipient_info(p7,ri)) goto err;
474 int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri)
479 i=OBJ_obj2nid(p7->type);
483 sk= p7->d.signed_and_enveloped->recipientinfo;
486 sk= p7->d.enveloped->recipientinfo;
520 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
522 if (PKCS7_type_is_signed(p7))
523 return(X509_find_by_issuer_and_serial(p7->d.sign->cert,
530 int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher)
536 i=OBJ_obj2nid(p7->type);
540 ec=p7->d.signed_and_enveloped->enc_data;
543 ec=p7->d.enveloped->enc_data;