Lines Matching refs:p7

65 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
70 nid=OBJ_obj2nid(p7->type);
77 ret=p7->detached=(int)larg;
78 if (ret && PKCS7_type_is_data(p7->d.sign->contents))
81 os=p7->d.sign->contents->d.data;
83 p7->d.sign->contents->d.data = NULL;
95 if(!p7->d.sign || !p7->d.sign->contents->d.ptr)
99 p7->detached = ret;
115 int PKCS7_content_new(PKCS7 *p7, int type)
121 if (!PKCS7_set_content(p7,ret)) goto err;
129 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data)
133 i=OBJ_obj2nid(p7->type);
137 if (p7->d.sign->contents != NULL)
138 PKCS7_free(p7->d.sign->contents);
139 p7->d.sign->contents=p7_data;
142 if (p7->d.digest->contents != NULL)
143 PKCS7_free(p7->d.digest->contents);
144 p7->d.digest->contents=p7_data;
159 int PKCS7_set_type(PKCS7 *p7, int type)
163 /*PKCS7_content_free(p7);*/
169 p7->type=obj;
170 if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL)
172 if (!ASN1_INTEGER_set(p7->d.sign->version,1))
174 PKCS7_SIGNED_free(p7->d.sign);
175 p7->d.sign=NULL;
180 p7->type=obj;
181 if ((p7->d.data=M_ASN1_OCTET_STRING_new()) == NULL)
185 p7->type=obj;
186 if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new())
188 ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1);
189 if (!ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1))
191 p7->d.signed_and_enveloped->enc_data->content_type
195 p7->type=obj;
196 if ((p7->d.enveloped=PKCS7_ENVELOPE_new())
198 if (!ASN1_INTEGER_set(p7->d.enveloped->version,0))
200 p7->d.enveloped->enc_data->content_type
204 p7->type=obj;
205 if ((p7->d.encrypted=PKCS7_ENCRYPT_new())
207 if (!ASN1_INTEGER_set(p7->d.encrypted->version,0))
209 p7->d.encrypted->enc_data->content_type
214 p7->type=obj;
215 if ((p7->d.digest=PKCS7_DIGEST_new())
217 if (!ASN1_INTEGER_set(p7->d.digest->version,0))
229 int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other)
231 p7->type = OBJ_nid2obj(type);
232 p7->d.other = other;
236 int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi)
243 i=OBJ_obj2nid(p7->type);
247 signer_sk= p7->d.sign->signer_info;
248 md_sk= p7->d.sign->md_algs;
251 signer_sk= p7->d.signed_and_enveloped->signer_info;
252 md_sk= p7->d.signed_and_enveloped->md_algs;
295 int PKCS7_add_certificate(PKCS7 *p7, X509 *x509)
300 i=OBJ_obj2nid(p7->type);
304 sk= &(p7->d.sign->cert);
307 sk= &(p7->d.signed_and_enveloped->cert);
330 int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
335 i=OBJ_obj2nid(p7->type);
339 sk= &(p7->d.sign->crl);
342 sk= &(p7->d.signed_and_enveloped->crl);
413 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey,
434 if (!PKCS7_add_signer(p7,si)) goto err;
442 int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md)
444 if (PKCS7_type_is_digest(p7))
446 if(!(p7->d.digest->md->parameter = ASN1_TYPE_new()))
451 p7->d.digest->md->parameter->type = V_ASN1_NULL;
452 p7->d.digest->md->algorithm = OBJ_nid2obj(EVP_MD_nid(md));
460 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
462 if (PKCS7_type_is_signed(p7))
464 return(p7->d.sign->signer_info);
466 else if (PKCS7_type_is_signedAndEnveloped(p7))
468 return(p7->d.signed_and_enveloped->signer_info);
491 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509)
497 if (!PKCS7_add_recipient_info(p7,ri)) goto err;
505 int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri)
510 i=OBJ_obj2nid(p7->type);
514 sk= p7->d.signed_and_enveloped->recipientinfo;
517 sk= p7->d.enveloped->recipientinfo;
581 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
583 if (PKCS7_type_is_signed(p7))
584 return(X509_find_by_issuer_and_serial(p7->d.sign->cert,
591 int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher)
596 i=OBJ_obj2nid(p7->type);
600 ec=p7->d.signed_and_enveloped->enc_data;
603 ec=p7->d.enveloped->enc_data;
621 int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
625 switch (OBJ_obj2nid(p7->type))
628 os = p7->d.data;
632 os = p7->d.signed_and_enveloped->enc_data->enc_data;
636 p7->d.signed_and_enveloped->enc_data->enc_data=os;
641 os = p7->d.enveloped->enc_data->enc_data;
645 p7->d.enveloped->enc_data->enc_data=os;
650 os=p7->d.sign->contents->d.data;