1ASN1_ITEM_D2I_BIO(3ossl) OpenSSL ASN1_ITEM_D2I_BIO(3ossl)
2
3
4
6 ASN1_item_d2i_ex, ASN1_item_d2i, ASN1_item_d2i_bio_ex,
7 ASN1_item_d2i_bio, ASN1_item_d2i_fp_ex, ASN1_item_d2i_fp,
8 ASN1_item_i2d_mem_bio - decode and encode DER-encoded ASN.1 structures
9
11 #include <openssl/asn1.h>
12
13 ASN1_VALUE *ASN1_item_d2i_ex(ASN1_VALUE **pval, const unsigned char **in,
14 long len, const ASN1_ITEM *it,
15 OSSL_LIB_CTX *libctx, const char *propq);
16 ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, const unsigned char **in,
17 long len, const ASN1_ITEM *it);
18
19 void *ASN1_item_d2i_bio_ex(const ASN1_ITEM *it, BIO *in, void *x,
20 OSSL_LIB_CTX *libctx, const char *propq);
21 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
22
23 void *ASN1_item_d2i_fp_ex(const ASN1_ITEM *it, FILE *in, void *x,
24 OSSL_LIB_CTX *libctx, const char *propq);
25 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
26
27 BIO *ASN1_item_i2d_mem_bio(const ASN1_ITEM *it, const ASN1_VALUE *val);
28
30 ASN1_item_d2i_ex() decodes the contents of the data stored in *in of
31 length len which must be a DER-encoded ASN.1 structure, using the ASN.1
32 template it. It places the result in *pval unless pval is NULL. If
33 *pval is non-NULL on entry then the ASN1_VALUE present there will be
34 reused. Otherwise a new ASN1_VALUE will be allocated. If any algorithm
35 fetches are required during the process then they will use the
36 OSSL_LIB_CTXprovided in the libctx parameter and the property query
37 string in propq. See "ALGORITHM FETCHING" in crypto(7) for more
38 information about algorithm fetching. On exit *in will be updated to
39 point to the next byte in the buffer after the decoded structure.
40
41 ASN1_item_d2i() is the same as ASN1_item_d2i_ex() except that the
42 default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query
43 string.
44
45 ASN1_item_d2i_bio_ex() decodes the contents of its input BIO in, which
46 must be a DER-encoded ASN.1 structure, using the ASN.1 template it and
47 places the result in *pval unless pval is NULL. If in is NULL it
48 returns NULL, else a pointer to the parsed structure. If any algorithm
49 fetches are required during the process then they will use the
50 OSSL_LIB_CTX provided in the libctx parameter and the property query
51 string in propq. See "ALGORITHM FETCHING" in crypto(7) for more
52 information about algorithm fetching.
53
54 ASN1_item_d2i_bio() is the same as ASN1_item_d2i_bio_ex() except that
55 the default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property
56 query string.
57
58 ASN1_item_d2i_fp_ex() is the same as ASN1_item_d2i_bio_ex() except that
59 a FILE pointer is provided instead of a BIO.
60
61 ASN1_item_d2i_fp() is the same as ASN1_item_d2i_fp_ex() except that the
62 default OSSL_LIB_CTX is used (i.e. NULL) and with a NULL property query
63 string.
64
65 ASN1_item_i2d_mem_bio() encodes the given ASN.1 value val using the
66 ASN.1 template it and returns the result in a memory BIO.
67
69 ASN1_item_d2i_bio() returns a pointer to an ASN1_VALUE or NULL.
70
71 ASN1_item_i2d_mem_bio() returns a pointer to a memory BIO or NULL on
72 error.
73
75 The functions ASN1_item_d2i_ex(), ASN1_item_d2i_bio_ex(),
76 ASN1_item_d2i_fp_ex() and ASN1_item_i2d_mem_bio() were added in OpenSSL
77 3.0.
78
80 Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
81
82 Licensed under the Apache License 2.0 (the "License"). You may not use
83 this file except in compliance with the License. You can obtain a copy
84 in the file LICENSE in the source distribution or at
85 <https://www.openssl.org/source/license.html>.
86
87
88
893.0.9 2023-07-27 ASN1_ITEM_D2I_BIO(3ossl)