Fix many inconsistencies in doc of CMS_verify() and PKC7_verify() etc.

Also change B< to I< in {CMS,PKCS7}_verify.pod, PKCS7_sign{,_add_signer}.pod

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18915)
This commit is contained in:
Dr. David von Oheimb 2022-07-29 13:09:52 +02:00 committed by Dr. David von Oheimb
parent 948c656c66
commit cae1d08f2c
6 changed files with 151 additions and 117 deletions

View File

@ -22,14 +22,17 @@ CMS_add0_crl, CMS_add1_crl, CMS_get1_crls
CMS_add0_cert() and CMS_add1_cert() add certificate I<cert> to I<cms>. CMS_add0_cert() and CMS_add1_cert() add certificate I<cert> to I<cms>.
I<cms> must be of type signed data or (authenticated) enveloped data. I<cms> must be of type signed data or (authenticated) enveloped data.
For signed data, such a certificate can be used to fill in the signer For signed data, such a certificate can be used when signing or verifying
certificate and may also be helpful for chain building in certificate validation. to fill in the signer certificate or to provide an extra CA certificate
that may be needed for chain building in certificate validation.
CMS_get1_certs() returns all certificates in I<cms>. CMS_get1_certs() returns all certificates in I<cms>.
CMS_add0_crl() and CMS_add1_crl() add CRL I<crl> to I<cms>. CMS_add0_crl() and CMS_add1_crl() add CRL I<crl> to I<cms>.
I<cms> must be of type signed data or (authenticated) enveloped data. I<cms> must be of type signed data or (authenticated) enveloped data.
For signed data, such a CRL may be used in certificate validation. For signed data, such a CRL may be used in certificate validation.
It may be given both for inclusion when signing a CMS message
and when verifying a signed CMS message.
CMS_get1_crls() returns all CRLs in I<cms>. CMS_get1_crls() returns all CRLs in I<cms>.

View File

@ -21,15 +21,19 @@ CMS_get0_signers - verify a CMS SignedData structure
=head1 DESCRIPTION =head1 DESCRIPTION
CMS_verify() verifies a B<CMS SignedData> structure CMS_verify() is very similar to L<PKCS7_verify(3)>. It verifies a
contained in a structure of type B<CMS_ContentInfo>. B<CMS SignedData> structure contained in a structure of type B<CMS_ContentInfo>.
I<cms> points to the B<CMS_ContentInfo> structure to verify. I<cms> points to the B<CMS_ContentInfo> structure to verify.
I<certs> is a set of certificates in which to search for signing certificate(s). The optional I<certs> parameter refers to a set of certificates
I<store> is a trusted certificate store used for chain verification. in which to search for signing certificates.
I<detached_data> refers to the content if the content is not present in I<cms>. I<cms> may contain extra untrusted CA certificates that may be used for
The content is written to the BIO I<out> if it is not NULL. chain building as well as CRLs that may be used for certificate validation.
I<flags> is an optional set of flags, which can be used to modify the verify I<store> may be NULL or point to
operation. the trusted certificate store to use for chain verification.
I<detached_data> refers to the signed data if the content is detached from I<cms>.
Otherwise I<detached_data> should be NULL and the signed data must be in I<cms>.
The content is written to the BIO I<out> unless it is NULL.
I<flags> is an optional set of flags, which can be used to modify the operation.
CMS_SignedData_verify() is like CMS_verify() except that CMS_SignedData_verify() is like CMS_verify() except that
it operates on B<CMS SignedData> input in the I<sd> argument, it operates on B<CMS SignedData> input in the I<sd> argument,
@ -56,26 +60,29 @@ the content is detached I<detached_data> cannot be NULL.
An attempt is made to locate all the signing certificate(s), first looking in An attempt is made to locate all the signing certificate(s), first looking in
the I<certs> parameter (if it is not NULL) and then looking in any the I<certs> parameter (if it is not NULL) and then looking in any
certificates contained in the I<cms> structure itself. If any signing certificates contained in the I<cms> structure unless B<CMS_NOINTERN> is set.
certificate cannot be located the operation fails. If any signing certificate cannot be located the operation fails.
Each signing certificate is chain verified using the I<smimesign> purpose and Each signing certificate is chain verified using the I<smimesign> purpose and
the supplied trusted certificate store. Any internal certificates in the message using the trusted certificate store I<store> if supplied.
are used as untrusted CAs. If CRL checking is enabled in I<store> any internal Any internal certificates in the message, which may have been added using
CRLs are used in addition to attempting to look them up in I<store>. If any L<CMS_add1_cert(3)>, are used as untrusted CAs.
chain verify fails an error code is returned. If CRL checking is enabled in I<store> and B<CMS_NOCRL> is not set,
any internal CRLs, which may have been added using L<CMS_add1_crl(3)>,
are used in addition to attempting to look them up in I<store>.
If I<store> is not NULL and any chain verify fails an error code is returned.
Finally the signed content is read (and written to I<out> if it is not NULL) Finally the signed content is read (and written to I<out> unless it is NULL)
and the signature's checked. and the signature is checked.
If all signature's verify correctly then the function is successful. If all signatures verify correctly then the function is successful.
Any of the following flags (ored together) can be passed in the I<flags> Any of the following flags (ored together) can be passed in the I<flags>
parameter to change the default verify behaviour. parameter to change the default verify behaviour.
If B<CMS_NOINTERN> is set the certificates in the message itself are not If B<CMS_NOINTERN> is set the certificates in the message itself are not
searched when locating the signing certificate(s). This means that all the searched when locating the signing certificate(s).
signing certificates must be in the I<certs> parameter. This means that all the signing certificates must be in the I<certs> parameter.
If B<CMS_NOCRL> is set and CRL checking is enabled in I<store> then any If B<CMS_NOCRL> is set and CRL checking is enabled in I<store> then any
CRLs in the message itself and provided via the I<crls> parameter are ignored. CRLs in the message itself and provided via the I<crls> parameter are ignored.
@ -85,7 +92,7 @@ from the content. If the content is not of type C<text/plain> then an error is
returned. returned.
If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not
verified, unless CMS_CADES flag is also set. chain verified, unless B<CMS_CADES> flag is also set.
If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not
verified, unless CMS_CADES flag is also set. verified, unless CMS_CADES flag is also set.
@ -100,14 +107,14 @@ If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked.
One application of B<CMS_NOINTERN> is to only accept messages signed by One application of B<CMS_NOINTERN> is to only accept messages signed by
a small number of certificates. The acceptable certificates would be passed a small number of certificates. The acceptable certificates would be passed
in the I<certs> parameter. In this case if the signer is not one of the in the I<certs> parameter. In this case if the signer certificate is not one
certificates supplied in I<certs> then the verify will fail because the of the certificates supplied in I<certs> then the verify will fail because the
signer cannot be found. signer cannot be found.
In some cases the standard techniques for looking up and validating In some cases the standard techniques for looking up and validating
certificates are not appropriate: for example an application may wish to certificates are not appropriate: for example an application may wish to
lookup certificates in a database or perform customised verification. This lookup certificates in a database or perform customised verification. This
can be achieved by setting and verifying the signers certificates manually can be achieved by setting and verifying the signer certificates manually
using the signed data utility functions. using the signed data utility functions.
Care should be taken when modifying the default verify behaviour, for example Care should be taken when modifying the default verify behaviour, for example
@ -123,8 +130,7 @@ timestamp).
=head1 RETURN VALUES =head1 RETURN VALUES
CMS_verify() returns 1 for a successful verification and zero if an error CMS_verify() returns 1 for a successful verification and 0 if an error occurred.
occurred.
CMS_SignedData_verify() returns a memory BIO containing the verfied content, CMS_SignedData_verify() returns a memory BIO containing the verfied content,
or NULL on error. or NULL on error.
@ -135,8 +141,8 @@ The error can be obtained from L<ERR_get_error(3)>.
=head1 BUGS =head1 BUGS
The trusted certificate store is not searched for the signing certificate, The trusted certificate store is not searched for the signing certificate.
this is primarily due to the inadequacies of the current B<X509_STORE> This is primarily due to the inadequacies of the current B<X509_STORE>
functionality. functionality.
The lack of single pass processing means that the signed content must all The lack of single pass processing means that the signed content must all
@ -144,6 +150,7 @@ be held in memory if it is not detached.
=head1 SEE ALSO =head1 SEE ALSO
L<PKCS7_verify(3)>, L<CMS_add1_cert(3)>, L<CMS_add1_crl(3)>,
L<OSSL_ESS_check_signing_certs(3)>, L<OSSL_ESS_check_signing_certs(3)>,
L<ERR_get_error(3)>, L<CMS_sign(3)> L<ERR_get_error(3)>, L<CMS_sign(3)>

View File

@ -18,28 +18,28 @@ PKCS7_sign_ex, PKCS7_sign
=head1 DESCRIPTION =head1 DESCRIPTION
PKCS7_sign_ex() creates and returns a PKCS#7 signedData structure. PKCS7_sign_ex() creates and returns a PKCS#7 signedData structure.
I<igncert> is the certificate to sign with, Ipkey> is the corresponding I<signcert> is the certificate to sign with, I<pkey> is the corresponding
private key. I<certs> is an optional additional set of certificates to include private key. I<certs> is an optional set of extra certificates to include
in the PKCS#7 structure (for example any intermediate CAs in the chain). The in the PKCS#7 structure (for example any intermediate CAs in the chain).
library context I<libctx> and property query I<propq> are used when The library context I<libctx> and property query I<propq> are used when
retrieving algorithms from providers. retrieving algorithms from providers.
The data to be signed is read from BIO B<data>. The data to be signed is read from BIO I<data>.
B<flags> is an optional set of flags. I<flags> is an optional set of flags.
Any of the following flags (ored together) can be passed in the B<flags> Any of the following flags (ored together) can be passed in the I<flags>
parameter. parameter.
Many S/MIME clients expect the signed content to include valid MIME headers. If Many S/MIME clients expect the signed content to include valid MIME headers. If
the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are prepended the B<PKCS7_TEXT> flag is set MIME headers for type C<text/plain> are prepended
to the data. to the data.
If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the If B<PKCS7_NOCERTS> is set the signer's certificate and the extra I<certs>
PKCS7 structure, the signer's certificate must still be supplied in the will not be included in the PKCS7 structure.
B<signcert> parameter though. This can reduce the size of the signature if the The signer's certificate must still be supplied in the I<signcert> parameter
signers certificate can be obtained by other means: for example a previously though. This can reduce the size of the signatures if the signer's certificates
signed message. can be obtained by other means: for example a previously signed message.
The data being signed is included in the PKCS7 structure, unless The data being signed is included in the PKCS7 structure, unless
B<PKCS7_DETACHED> is set in which case it is omitted. This is used for PKCS7 B<PKCS7_DETACHED> is set in which case it is omitted. This is used for PKCS7
@ -63,7 +63,7 @@ these algorithms is disabled then it will not be included.
If the flags B<PKCS7_STREAM> is set then the returned B<PKCS7> structure is If the flags B<PKCS7_STREAM> is set then the returned B<PKCS7> structure is
just initialized ready to perform the signing operation. The signing is however just initialized ready to perform the signing operation. The signing is however
B<not> performed and the data to be signed is not read from the B<data> B<not> performed and the data to be signed is not read from the I<data>
parameter. Signing is deferred until after the data has been written. In this parameter. Signing is deferred until after the data has been written. In this
way data can be signed in a single pass. way data can be signed in a single pass.
@ -82,20 +82,21 @@ BIO_new_PKCS7().
If a signer is specified it will use the default digest for the signing If a signer is specified it will use the default digest for the signing
algorithm. This is B<SHA1> for both RSA and DSA keys. algorithm. This is B<SHA1> for both RSA and DSA keys.
The B<certs>, B<signcert> and B<pkey> parameters can all be The I<certs>, I<signcert> and I<pkey> parameters can all be
B<NULL> if the B<PKCS7_PARTIAL> flag is set. One or more signers can be added NULL if the B<PKCS7_PARTIAL> flag is set. One or more signers can be added
using the function PKCS7_sign_add_signer(). PKCS7_final() must also be using the function PKCS7_sign_add_signer(). PKCS7_final() must also be
called to finalize the structure if streaming is not enabled. Alternative called to finalize the structure if streaming is not enabled. Alternative
signing digests can also be specified using this method. signing digests can also be specified using this method.
If B<signcert> and B<pkey> are NULL then a certificates only If I<signcert> and I<pkey> are NULL then a certificates only
PKCS#7 structure is output. PKCS#7 structure is output.
In versions of OpenSSL before 1.0.0 the B<signcert> and B<pkey> parameters must In versions of OpenSSL before 1.0.0 the I<signcert> and I<pkey> parameters must
B<NOT> be NULL. not be NULL.
PKCS7_sign() is similar to PKCS7_sign_ex() but uses default values of PKCS7_sign() is like PKCS7_sign_ex() except that it uses default values of
NULL for the library context I<libctx> and the property query I<propq>. NULL for the library context I<libctx> and the property query I<propq>.
This is retained for API backward compatibiliy.
=head1 BUGS =head1 BUGS
@ -114,8 +115,8 @@ L<ERR_get_error(3)>, L<PKCS7_verify(3)>
The function PKCS7_sign_ex() was added in OpenSSL 3.0. The function PKCS7_sign_ex() was added in OpenSSL 3.0.
The B<PKCS7_PARTIAL> flag, and the ability for B<certs>, B<signcert>, The B<PKCS7_PARTIAL> flag, and the ability for I<certs>, I<signcert>,
and B<pkey> parameters to be B<NULL> were added in OpenSSL 1.0.0. and I<pkey> parameters to be NULL were added in OpenSSL 1.0.0.
The B<PKCS7_STREAM> flag was added in OpenSSL 1.0.0. The B<PKCS7_STREAM> flag was added in OpenSSL 1.0.0.

View File

@ -2,7 +2,8 @@
=head1 NAME =head1 NAME
PKCS7_sign_add_signer - add a signer PKCS7 signed data structure PKCS7_sign_add_signer,
PKCS7_add_certificate, PKCS7_add_crl - add information to PKCS7 structure
=head1 SYNOPSIS =head1 SYNOPSIS
@ -10,22 +11,22 @@ PKCS7_sign_add_signer - add a signer PKCS7 signed data structure
PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert,
EVP_PKEY *pkey, const EVP_MD *md, int flags); EVP_PKEY *pkey, const EVP_MD *md, int flags);
int PKCS7_add_certificate(PKCS7 *p7, X509 *cert);
int PKCS7_add_crl(PKCS7 *p7, X509_CRL *crl);
=head1 DESCRIPTION =head1 DESCRIPTION
PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private PKCS7_sign_add_signer() adds a signer with certificate I<signcert> and private
key B<pkey> using message digest B<md> to a PKCS7 signed data structure key I<pkey> using message digest I<md> to a PKCS7 signed data structure I<p7>.
B<p7>.
The PKCS7 structure should be obtained from an initial call to PKCS7_sign() The B<PKCS7> structure should be obtained from an initial call to PKCS7_sign()
with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7 with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS#7
signed data structure. signed data structure.
If the B<md> parameter is B<NULL> then the default digest for the public If the I<md> parameter is NULL then the default digest for the public
key algorithm will be used. key algorithm will be used.
Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned B<PKCS7> structure
is not complete and must be finalized either by streaming (if applicable) or is not complete and must be finalized either by streaming (if applicable) or
a call to PKCS7_final(). a call to PKCS7_final().
@ -37,13 +38,13 @@ signed data structure where the simpler PKCS7_sign() function defaults are
not appropriate. For example if multiple signers or non default digest not appropriate. For example if multiple signers or non default digest
algorithms are needed. algorithms are needed.
Any of the following flags (ored together) can be passed in the B<flags> Any of the following flags (ored together) can be passed in the I<flags>
parameter. parameter.
If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content
digest value from the PKCS7 structure: to add a signer to an existing structure. digest value from the B<PKCS7> structure: to add a signer to an existing structure.
An error occurs if a matching digest value cannot be found to copy. The An error occurs if a matching digest value cannot be found to copy. The
returned PKCS7 structure will be valid and finalized when this flag is set. returned B<PKCS7> structure will be valid and finalized when this flag is set.
If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the
B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes
@ -51,8 +52,8 @@ can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is
needed to finalize it. needed to finalize it.
If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the
PKCS7 structure, the signer's certificate must still be supplied in the B<PKCS7> structure, the signer's certificate must still be supplied in the
B<signcert> parameter though. This can reduce the size of the signature if the I<signcert> parameter though. This can reduce the size of the signature if the
signers certificate can be obtained by other means: for example a previously signers certificate can be obtained by other means: for example a previously
signed message. signed message.
@ -66,20 +67,32 @@ If present the SMIMECapabilities attribute indicates support for the following
algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of
these algorithms is disabled then it will not be included. these algorithms is disabled then it will not be included.
PKCS7_sign_add_signers() returns an internal pointer to the B<PKCS7_SIGNER_INFO>
PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO structure just added, which can be used to set additional attributes
structure just added, this can be used to set additional attributes
before it is finalized. before it is finalized.
PKCS7_add_certificate() adds to the B<PKCS7> structure I<p7> the certificate
I<cert>, which may be an end-entity (signer) certificate
or a CA certificate useful for chain building.
This is done internally by L<PKCS7_sign_ex(3)> and similar signing functions.
It may have to be used before calling L<PKCS7_verify(3)>
in order to provide any missing certificate(s) needed for verification.
PKCS7_add_crl() adds the CRL I<crl> to the B<PKCS7> structure I<p7>.
This may be called to provide certificate status information
to be included when signing or to use when verifying the B<PKCS7> structure.
=head1 RETURN VALUES =head1 RETURN VALUES
PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO PKCS7_sign_add_signers() returns an internal pointer to the B<PKCS7_SIGNER_INFO>
structure just added or NULL if an error occurs. structure just added or NULL if an error occurs.
PKCS7_add_certificate() and PKCS7_add_crl() return 1 on success, 0 on error.
=head1 SEE ALSO =head1 SEE ALSO
L<ERR_get_error(3)>, L<PKCS7_sign(3)>, L<ERR_get_error(3)>, L<PKCS7_sign_ex(3)>,
L<PKCS7_final(3)>, L<PKCS7_final(3)>, L<PKCS7_verify(3)>
=head1 HISTORY =head1 HISTORY

View File

@ -15,64 +15,76 @@ PKCS7_verify, PKCS7_get0_signers - verify a PKCS#7 signedData structure
=head1 DESCRIPTION =head1 DESCRIPTION
PKCS7_verify() verifies a PKCS#7 signedData structure. B<p7> is the PKCS7 PKCS7_verify() is very similar to L<CMS_verify(3)>.
structure to verify. B<certs> is a set of certificates in which to search for It verifies a PKCS#7 signedData structure given in I<p7>.
the signer's certificate. B<store> is a trusted certificate store (used for The optional I<certs> parameter refers to a set of certificates
chain verification). B<indata> is the signed data if the content is not in which to search for signer's certificates.
present in B<p7> (that is it is detached). The content is written to B<out> I<p7> may contain extra untrusted CA certificates that may be used for
if it is not NULL. chain building as well as CRLs that may be used for certificate validation.
I<store> may be NULL or point to
the trusted certificate store to use for chain verification.
I<indata> refers to the signed data if the content is detached from I<p7>.
Otherwise I<indata> should be NULL, and then the signed data must be in I<p7>.
The content is written to the BIO I<out> unless it is NULL.
I<flags> is an optional set of flags, which can be used to modify the operation.
B<flags> is an optional set of flags, which can be used to modify the verify PKCS7_get0_signers() retrieves the signer's certificates from I<p7>, it does
operation. B<not> check their validity or whether any signatures are valid. The I<certs>
and I<flags> parameters have the same meanings as in PKCS7_verify().
PKCS7_get0_signers() retrieves the signer's certificates from B<p7>, it does
B<not> check their validity or whether any signatures are valid. The B<certs>
and B<flags> parameters have the same meanings as in PKCS7_verify().
=head1 VERIFY PROCESS =head1 VERIFY PROCESS
Normally the verify process proceeds as follows. Normally the verify process proceeds as follows.
Initially some sanity checks are performed on B<p7>. The type of B<p7> must Initially some sanity checks are performed on I<p7>. The type of I<p7> must
be signedData. There must be at least one signature on the data and if be SignedData. There must be at least one signature on the data and if
the content is detached B<indata> cannot be B<NULL>. If the content is the content is detached I<indata> cannot be NULL. If the content is
not detached and B<indata> is not B<NULL>, then the structure has both not detached and I<indata> is not NULL then the structure has both
embedded and external content. To treat this as an error, use the flag embedded and external content. To treat this as an error, use the flag
B<PKCS7_NO_DUAL_CONTENT>. B<PKCS7_NO_DUAL_CONTENT>.
The default behavior allows this, for compatibility with older The default behavior allows this, for compatibility with older
versions of OpenSSL. versions of OpenSSL.
An attempt is made to locate all the signer's certificates, first looking in An attempt is made to locate all the signer's certificates, first looking in
the B<certs> parameter (if it is not B<NULL>) and then looking in any certificates the I<certs> parameter (if it is not NULL). Then they are looked up in any
contained in the B<p7> structure itself. If any signer's certificates cannot be certificates contained in the I<p7> structure unless B<PKCS7_NOINTERN> is set.
located the operation fails. If any signer's certificates cannot be located the operation fails.
Each signer's certificate is chain verified using the B<smimesign> purpose and Each signer's certificate is chain verified using the B<smimesign> purpose and
the supplied trusted certificate store. Any internal certificates in the message using the trusted certificate store I<store> if supplied.
are used as untrusted CAs. If any chain verify fails an error code is returned. Any internal certificates in the message, which may have been added using
L<PKCS7_add_certificate(3)>, are used as untrusted CAs unless B<PKCS7_NOCHAIN>
is set.
If CRL checking is enabled in I<store> and B<PKCS7_NOCRL> is not set,
any internal CRLs, which may have been added using L<PKCS7_add_crl(3)>,
are used in addition to attempting to look them up in I<store>.
If I<store> is not NULL and any chain verify fails an error code is returned.
Finally the signed content is read (and written to B<out> is it is not NULL) and Finally the signed content is read (and written to I<out> unless it is NULL)
the signature's checked. and the signature is checked.
If all signature's verify correctly then the function is successful. If all signatures verify correctly then the function is successful.
Any of the following flags (ored together) can be passed in the B<flags> parameter Any of the following flags (ored together) can be passed in the I<flags>
to change the default verify behaviour. Only the flag B<PKCS7_NOINTERN> is parameter to change the default verify behaviour.
meaningful to PKCS7_get0_signers(). Only the flag B<PKCS7_NOINTERN> is meaningful to PKCS7_get0_signers().
If B<PKCS7_NOINTERN> is set the certificates in the message itself are not If B<PKCS7_NOINTERN> is set the certificates in the message itself are not
searched when locating the signer's certificate. This means that all the signers searched when locating the signer's certificates.
certificates must be in the B<certs> parameter. This means that all the signer's certificates must be in the I<certs> parameter.
If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> are deleted If B<PKCS7_NOCRL> is set and CRL checking is enabled in I<store> then any
from the content. If the content is not of type B<text/plain> then an error is CRLs in the message itself are ignored.
If the B<PKCS7_TEXT> flag is set MIME headers for type C<text/plain> are deleted
from the content. If the content is not of type C<text/plain> then an error is
returned. returned.
If B<PKCS7_NOVERIFY> is set the signer's certificates are not chain verified. If B<PKCS7_NOVERIFY> is set the signer's certificates are not chain verified.
If B<PKCS7_NOCHAIN> is set then the certificates contained in the message are If B<PKCS7_NOCHAIN> is set then the certificates contained in the message are
not used as untrusted CAs. This means that the whole verify chain (apart from not used as untrusted CAs. This means that the whole verify chain (apart from
the signer's certificate) must be contained in the trusted store. the signer's certificates) must be contained in the trusted store.
If B<PKCS7_NOSIGS> is set then the signatures on the data are not checked. If B<PKCS7_NOSIGS> is set then the signatures on the data are not checked.
@ -80,14 +92,14 @@ If B<PKCS7_NOSIGS> is set then the signatures on the data are not checked.
One application of B<PKCS7_NOINTERN> is to only accept messages signed by One application of B<PKCS7_NOINTERN> is to only accept messages signed by
a small number of certificates. The acceptable certificates would be passed a small number of certificates. The acceptable certificates would be passed
in the B<certs> parameter. In this case if the signer is not one of the in the I<certs> parameter. In this case if the signer's certificate is not one
certificates supplied in B<certs> then the verify will fail because the of the certificates supplied in I<certs> then the verify will fail because the
signer cannot be found. signer cannot be found.
Care should be taken when modifying the default verify behaviour, for example Care should be taken when modifying the default verify behaviour, for example
setting C<PKCS7_NOVERIFY|PKCS7_NOSIGS> will totally disable all verification setting C<PKCS7_NOVERIFY|PKCS7_NOSIGS> will totally disable all verification
and any signed message will be considered valid. This combination is however and any signed message will be considered valid. This combination is however
useful if one merely wishes to write the content to B<out> and its validity useful if one merely wishes to write the content to I<out> and its validity
is not considered important. is not considered important.
Chain verification should arguably be performed using the signing time rather Chain verification should arguably be performed using the signing time rather
@ -97,24 +109,24 @@ timestamp).
=head1 RETURN VALUES =head1 RETURN VALUES
PKCS7_verify() returns one for a successful verification and zero PKCS7_verify() returns 1 for a successful verification and 0 if an error occurs.
if an error occurs.
PKCS7_get0_signers() returns all signers or B<NULL> if an error occurred. PKCS7_get0_signers() returns all signers or NULL if an error occurred.
The error can be obtained from L<ERR_get_error(3)> The error can be obtained from L<ERR_get_error(3)>.
=head1 BUGS =head1 BUGS
The trusted certificate store is not searched for the signers certificate, The trusted certificate store is not searched for the signer's certificates.
this is primarily due to the inadequacies of the current B<X509_STORE> This is primarily due to the inadequacies of the current B<X509_STORE>
functionality. functionality.
The lack of single pass processing and need to hold all data in memory as The lack of single pass processing means that the signed content must all
mentioned in PKCS7_sign() also applies to PKCS7_verify(). be held in memory if it is not detached.
=head1 SEE ALSO =head1 SEE ALSO
L<CMS_verify(3)>, L<PKCS7_add_certificate(3)>, L<PKCS7_add_crl(3)>,
L<ERR_get_error(3)>, L<PKCS7_sign(3)> L<ERR_get_error(3)>, L<PKCS7_sign(3)>
=head1 COPYRIGHT =head1 COPYRIGHT

View File

@ -887,8 +887,6 @@ PKCS7_add1_attrib_digest(3)
PKCS7_add_attrib_content_type(3) PKCS7_add_attrib_content_type(3)
PKCS7_add_attrib_smimecap(3) PKCS7_add_attrib_smimecap(3)
PKCS7_add_attribute(3) PKCS7_add_attribute(3)
PKCS7_add_certificate(3)
PKCS7_add_crl(3)
PKCS7_add_recipient(3) PKCS7_add_recipient(3)
PKCS7_add_recipient_info(3) PKCS7_add_recipient_info(3)
PKCS7_add_signature(3) PKCS7_add_signature(3)