Lines Matching refs:BIO
94 static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio);
101 static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret);
112 static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
115 BIO *b64;
123 /* prepend the b64 BIO so all data is base64 encoded.
133 static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
135 BIO *b64;
141 bio = BIO_push(b64, bio);
142 val = ASN1_item_d2i_bio(it, bio, NULL);
145 (void)BIO_flush(bio);
146 bio = BIO_pop(bio);
153 static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
205 int int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
235 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
236 BIO_printf(bio, "Content-Type: multipart/signed;");
237 BIO_printf(bio, " protocol=\"%ssignature\";", mime_prefix);
238 BIO_puts(bio, " micalg=\"");
239 asn1_write_micalg(bio, mdalgs);
240 BIO_printf(bio, "\"; boundary=\"----%s\"%s%s",
242 BIO_printf(bio, "This is an S/MIME signed message%s%s",
245 BIO_printf(bio, "------%s%s", bound, mime_eol);
246 if (!data_fn(bio, data, val, flags, it))
248 BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol);
252 BIO_printf(bio, "Content-Type: %ssignature;", mime_prefix);
253 BIO_printf(bio, " name=\"smime.p7s\"%s", mime_eol);
254 BIO_printf(bio, "Content-Transfer-Encoding: base64%s",
256 BIO_printf(bio, "Content-Disposition: attachment;");
257 BIO_printf(bio, " filename=\"smime.p7s\"%s%s",
259 B64_write_ASN1(bio, val, NULL, 0, it);
260 BIO_printf(bio,"%s------%s--%s%s", mime_eol, bound,
284 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
285 BIO_printf(bio, "Content-Disposition: attachment;");
286 BIO_printf(bio, " filename=\"%s\"%s", cname, mime_eol);
287 BIO_printf(bio, "Content-Type: %smime;", mime_prefix);
289 BIO_printf(bio, " smime-type=%s;", msg_type);
290 BIO_printf(bio, " name=\"%s\"%s", cname, mime_eol);
291 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s",
293 if (!B64_write_ASN1(bio, val, data, flags, it))
295 BIO_printf(bio, "%s", mime_eol);
304 static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
307 BIO *tmpbio;
340 /* Now remove any digests prepended to the BIO */
356 * in multipart case the content is placed in a memory BIO
360 ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it)
362 BIO *asnin;
364 STACK_OF(BIO) *parts = NULL;
372 if (!(headers = mime_parse_hdr(bio))) {
393 ret = multi_split(bio, prm->param_value, &parts);
455 if(!(val = b64_read_asn1(bio, it))) {
463 /* Copy text from one BIO to another making the output CRLF at EOL */
464 int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
466 BIO *bf;
502 int SMIME_text(BIO *in, BIO *out)
536 static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
541 BIO *bpart = NULL;
542 STACK_OF(BIO) *parts;
551 while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {
588 static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio)
598 while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {