|
NAMEPKCS7_dataInit —
construct a BIO chain for adding or retrieving content
SYNOPSIS#include <openssl/pkcs7.h>
BIO *
DESCRIPTIONPKCS7_dataInit () constructs a BIO chain in preparation
for putting data into or retrieving data out of p7.
Depending on the contentType of
p7, the created chain starts with:
One additional BIO is appended to the end of the chain, depending on the first condition that holds in the following list:
Adding contentBefore callingPKCS7_dataInit () in order to add content,
PKCS7_new(3),
PKCS7_set_type(3),
and
PKCS7_content_new(3)
are typically required to create p7, to choose its
desired type, and to allocate the nested ContentInfo
structure. Alternatively, for SignedData,
PKCS7_sign(3)
can be used with the PKCS7_PARTIAL or
PKCS7_STREAM flags or for
EnvelopedData,
PKCS7_encrypt(3)
with the PKCS7_STREAM flag.
After calling While Retrieving contentPKCS7_dataInit () can also be called on a fully populated
object of type SignedData or
DigestedData. After that,
BIO_read(3)
can be used to retrieve data from it. In this use case, do not call
PKCS7_dataFinal(3);
simply proceed directly to
BIO_free_all(3)
after reading the data.
RETURN VALUESPKCS7_dataInit () returns a BIO chain on success or
NULL on failure. It fails if p7
is NULL , if the content field of
p7 is empty, if the contentType of
p7 is unsupported, if a cipher is required but none is
configured, or if any required operation fails, for example due to lack of
memory or for various other reasons.
SEE ALSOBIO_new(3), BIO_read(3), PKCS7_content_new(3), PKCS7_dataFinal(3), PKCS7_encrypt(3), PKCS7_final(3), PKCS7_new(3), PKCS7_set_type(3), PKCS7_sign(3)HISTORYPKCS7_dataInit () first appeared in SSLeay 0.8.1 and has
been available since OpenBSD 2.4.
CAVEATSThis function does not support EncryptedData.BUGSIf p7 is a fully populated structure containing EnvelopedData, SignedAndEnvelopedData, or arbitrary data,PKCS7_dataInit () returns a BIO chain that ultimately
reads from an empty memory BIO, so reading from it will instantly return an
end-of-file indication rather than reading the actual data contained in
p7.
Visit the GSP FreeBSD Man Page Interface. |