Home | History | Annotate | Download | only in asn1

Lines Matching refs:bio

90 static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
97 static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio);
104 static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret);
115 int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
118 /* If streaming create stream BIO and copy all content through it */
121 BIO *bio, *tbio;
122 bio = BIO_new_NDEF(out, val, it);
123 if (!bio)
128 SMIME_crlf_copy(in, bio, flags);
129 (void)BIO_flush(bio);
130 /* Free up successive BIOs until we hit the old output BIO */
133 tbio = BIO_pop(bio);
134 BIO_free(bio);
135 bio = tbio;
136 } while (bio != out);
148 static int B64_write_ASN1(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
151 BIO *b64;
159 /* prepend the b64 BIO so all data is base64 encoded.
171 int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
182 static ASN1_VALUE *b64_read_asn1(BIO *bio, const ASN1_ITEM *it)
184 BIO *b64;
190 bio = BIO_push(b64, bio);
191 val = ASN1_item_d2i_bio(it, bio, NULL);
194 (void)BIO_flush(bio);
195 bio = BIO_pop(bio);
202 static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
278 int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
307 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
308 BIO_printf(bio, "Content-Type: multipart/signed;");
309 BIO_printf(bio, " protocol=\"%ssignature\";", mime_prefix);
310 BIO_puts(bio, " micalg=\"");
311 asn1_write_micalg(bio, mdalgs);
312 BIO_printf(bio, "\"; boundary=\"----%s\"%s%s",
314 BIO_printf(bio, "This is an S/MIME signed message%s%s",
317 BIO_printf(bio, "------%s%s", bound, mime_eol);
318 if (!asn1_output_data(bio, data, val, flags, it))
320 BIO_printf(bio, "%s------%s%s", mime_eol, bound, mime_eol);
324 BIO_printf(bio, "Content-Type: %ssignature;", mime_prefix);
325 BIO_printf(bio, " name=\"smime.p7s\"%s", mime_eol);
326 BIO_printf(bio, "Content-Transfer-Encoding: base64%s",
328 BIO_printf(bio, "Content-Disposition: attachment;");
329 BIO_printf(bio, " filename=\"smime.p7s\"%s%s",
331 B64_write_ASN1(bio, val, NULL, 0, it);
332 BIO_printf(bio,"%s------%s--%s%s", mime_eol, bound,
356 BIO_printf(bio, "MIME-Version: 1.0%s", mime_eol);
357 BIO_printf(bio, "Content-Disposition: attachment;");
358 BIO_printf(bio, " filename=\"%s\"%s", cname, mime_eol);
359 BIO_printf(bio, "Content-Type: %smime;", mime_prefix);
361 BIO_printf(bio, " smime-type=%s;", msg_type);
362 BIO_printf(bio, " name=\"%s\"%s", cname, mime_eol);
363 BIO_printf(bio, "Content-Transfer-Encoding: base64%s%s",
365 if (!B64_write_ASN1(bio, val, data, flags, it))
367 BIO_printf(bio, "%s", mime_eol);
374 static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
377 BIO *tmpbio;
410 /* Now remove any digests prepended to the BIO */
424 * in multipart case the content is placed in a memory BIO
428 ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it)
430 BIO *asnin;
432 STACK_OF(BIO) *parts = NULL;
440 if (!(headers = mime_parse_hdr(bio))) {
461 ret = multi_split(bio, prm->param_value, &parts);
523 if(!(val = b64_read_asn1(bio, it))) {
531 /* Copy text from one BIO to another making the output CRLF at EOL */
532 int SMIME_crlf_copy(BIO *in, BIO *out, int flags)
534 BIO *bf;
570 int SMIME_text(BIO *in, BIO *out)
604 static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
609 BIO *bpart = NULL;
610 STACK_OF(BIO) *parts;
619 while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {
656 static STACK_OF(MIME_HEADER) *mime_parse_hdr(BIO *bio)
666 while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) {