Lines Matching defs:p7

65 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
70 nid = OBJ_obj2nid(p7->type);
76 ret = p7->detached = (int)larg;
77 if (ret && PKCS7_type_is_data(p7->d.sign->contents)) {
79 os = p7->d.sign->contents->d.data;
81 p7->d.sign->contents->d.data = NULL;
91 if (!p7->d.sign || !p7->d.sign->contents->d.ptr)
96 p7->detached = ret;
111 int PKCS7_content_new(PKCS7 *p7, int type)
119 if (!PKCS7_set_content(p7, ret))
129 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data)
133 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)
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)) {
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())
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())
199 if (!ASN1_INTEGER_set(p7->d.enveloped->version, 0))
201 p7->d.enveloped->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);
204 p7->type = obj;
205 if ((p7->d.encrypted = PKCS7_ENCRYPT_new())
208 if (!ASN1_INTEGER_set(p7->d.encrypted->version, 0))
210 p7->d.encrypted->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data);
214 p7->type = obj;
215 if ((p7->d.digest = PKCS7_DIGEST_new())
218 if (!ASN1_INTEGER_set(p7->d.digest->version, 0))
230 int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other)
232 p7->type = OBJ_nid2obj(type);
233 p7->d.other = other;
237 int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi)
244 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;
290 int PKCS7_add_certificate(PKCS7 *p7, X509 *x509)
295 i = OBJ_obj2nid(p7->type);
298 sk = &(p7->d.sign->cert);
301 sk = &(p7->d.signed_and_enveloped->cert);
322 int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl)
327 i = OBJ_obj2nid(p7->type);
330 sk = &(p7->d.sign->crl);
333 sk = &(p7->d.signed_and_enveloped->crl);
401 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509, EVP_PKEY *pkey,
421 if (!PKCS7_add_signer(p7, si))
430 int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md)
432 if (PKCS7_type_is_digest(p7)) {
433 if (!(p7->d.digest->md->parameter = ASN1_TYPE_new())) {
437 p7->d.digest->md->parameter->type = V_ASN1_NULL;
438 p7->d.digest->md->algorithm = OBJ_nid2obj(EVP_MD_nid(md));
446 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7)
448 if (p7 == NULL || p7->d.ptr == NULL)
450 if (PKCS7_type_is_signed(p7)) {
451 return (p7->d.sign->signer_info);
452 } else if (PKCS7_type_is_signedAndEnveloped(p7)) {
453 return (p7->d.signed_and_enveloped->signer_info);
475 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509)
483 if (!PKCS7_add_recipient_info(p7, ri))
492 int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri)
497 i = OBJ_obj2nid(p7->type);
500 sk = p7->d.signed_and_enveloped->recipientinfo;
503 sk = p7->d.enveloped->recipientinfo;
564 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si)
566 if (PKCS7_type_is_signed(p7))
567 return (X509_find_by_issuer_and_serial(p7->d.sign->cert,
575 int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher)
580 i = OBJ_obj2nid(p7->type);
583 ec = p7->d.signed_and_enveloped->enc_data;
586 ec = p7->d.enveloped->enc_data;
605 int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7)
609 switch (OBJ_obj2nid(p7->type)) {
611 os = p7->d.data;
615 os = p7->d.signed_and_enveloped->enc_data->enc_data;
618 p7->d.signed_and_enveloped->enc_data->enc_data = os;
623 os = p7->d.enveloped->enc_data->enc_data;
626 p7->d.enveloped->enc_data->enc_data = os;
631 os = p7->d.sign->contents->d.data;