156 lines
7.0 KiB
HTML
Executable File
156 lines
7.0 KiB
HTML
Executable File
<?xml version="1.0" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>CMS_verify</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<link rev="made" href="mailto:root@localhost" />
|
|
</head>
|
|
|
|
<body style="background-color: white">
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
<div name="index">
|
|
<p><a name="__index__"></a></p>
|
|
|
|
<ul>
|
|
|
|
<li><a href="#name">NAME</a></li>
|
|
<li><a href="#synopsis">SYNOPSIS</a></li>
|
|
<li><a href="#description">DESCRIPTION</a></li>
|
|
<li><a href="#verify_process">VERIFY PROCESS</a></li>
|
|
<li><a href="#notes">NOTES</a></li>
|
|
<li><a href="#return_values">RETURN VALUES</a></li>
|
|
<li><a href="#bugs">BUGS</a></li>
|
|
<li><a href="#see_also">SEE ALSO</a></li>
|
|
<li><a href="#copyright">COPYRIGHT</a></li>
|
|
</ul>
|
|
|
|
<hr name="index" />
|
|
</div>
|
|
<!-- INDEX END -->
|
|
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="name">NAME</a></h1>
|
|
<p>CMS_verify, CMS_get0_signers - verify a CMS SignedData structure</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<pre>
|
|
#include <openssl/cms.h></pre>
|
|
<pre>
|
|
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store,
|
|
BIO *indata, BIO *out, unsigned int flags);</pre>
|
|
<pre>
|
|
STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);</pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p><code>CMS_verify()</code> verifies a CMS SignedData structure. <strong>cms</strong> is the CMS_ContentInfo
|
|
structure to verify. <strong>certs</strong> is a set of certificates in which to search for
|
|
the signing certificate(s). <strong>store</strong> is a trusted certificate store used for
|
|
chain verification. <strong>indata</strong> is the detached content if the content is not
|
|
present in <strong>cms</strong>. The content is written to <strong>out</strong> if it is not NULL.</p>
|
|
<p><strong>flags</strong> is an optional set of flags, which can be used to modify the verify
|
|
operation.</p>
|
|
<p>CMS_get0_signers() retrieves the signing certificate(s) from <strong>cms</strong>, it must
|
|
be called after a successful <code>CMS_verify()</code> operation.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="verify_process">VERIFY PROCESS</a></h1>
|
|
<p>Normally the verify process proceeds as follows.</p>
|
|
<p>Initially some sanity checks are performed on <strong>cms</strong>. The type of <strong>cms</strong> must
|
|
be SignedData. There must be at least one signature on the data and if
|
|
the content is detached <strong>indata</strong> cannot be <strong>NULL</strong>.</p>
|
|
<p>An attempt is made to locate all the signing certificate(s), first looking in
|
|
the <strong>certs</strong> parameter (if it is not NULL) and then looking in any
|
|
certificates contained in the <strong>cms</strong> structure itself. If any signing
|
|
certificate cannot be located the operation fails.</p>
|
|
<p>Each signing certificate is chain verified using the <strong>smimesign</strong> purpose and
|
|
the supplied trusted certificate store. Any internal certificates in the message
|
|
are used as untrusted CAs. If CRL checking is enabled in <strong>store</strong> any internal
|
|
CRLs are used in addition to attempting to look them up in <strong>store</strong>. If any
|
|
chain verify fails an error code is returned.</p>
|
|
<p>Finally the signed content is read (and written to <strong>out</strong> if it is not NULL)
|
|
and the signature's checked.</p>
|
|
<p>If all signature's verify correctly then the function is successful.</p>
|
|
<p>Any of the following flags (ored together) can be passed in the <strong>flags</strong>
|
|
parameter to change the default verify behaviour.</p>
|
|
<p>If <strong>CMS_NOINTERN</strong> is set the certificates in the message itself are not
|
|
searched when locating the signing certificate(s). This means that all the
|
|
signing certificates must be in the <strong>certs</strong> parameter.</p>
|
|
<p>If <strong>CMS_NOCRL</strong> is set and CRL checking is enabled in <strong>store</strong> then any
|
|
CRLs in the message itself are ignored.</p>
|
|
<p>If the <strong>CMS_TEXT</strong> flag is set MIME headers for type <strong>text/plain</strong> are deleted
|
|
from the content. If the content is not of type <strong>text/plain</strong> then an error is
|
|
returned.</p>
|
|
<p>If <strong>CMS_NO_SIGNER_CERT_VERIFY</strong> is set the signing certificates are not
|
|
verified.</p>
|
|
<p>If <strong>CMS_NO_ATTR_VERIFY</strong> is set the signed attributes signature is not
|
|
verified.</p>
|
|
<p>If <strong>CMS_NO_CONTENT_VERIFY</strong> is set then the content digest is not checked.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="notes">NOTES</a></h1>
|
|
<p>One application of <strong>CMS_NOINTERN</strong> is to only accept messages signed by
|
|
a small number of certificates. The acceptable certificates would be passed
|
|
in the <strong>certs</strong> parameter. In this case if the signer is not one of the
|
|
certificates supplied in <strong>certs</strong> then the verify will fail because the
|
|
signer cannot be found.</p>
|
|
<p>In some cases the standard techniques for looking up and validating
|
|
certificates are not appropriate: for example an application may wish to
|
|
lookup certificates in a database or perform customised verification. This
|
|
can be achieved by setting and verifying the signers certificates manually
|
|
using the signed data utility functions.</p>
|
|
<p>Care should be taken when modifying the default verify behaviour, for example
|
|
setting <strong>CMS_NO_CONTENT_VERIFY</strong> will totally disable all content verification
|
|
and any modified content will be considered valid. This combination is however
|
|
useful if one merely wishes to write the content to <strong>out</strong> and its validity
|
|
is not considered important.</p>
|
|
<p>Chain verification should arguably be performed using the signing time rather
|
|
than the current time. However since the signing time is supplied by the
|
|
signer it cannot be trusted without additional evidence (such as a trusted
|
|
timestamp).</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="return_values">RETURN VALUES</a></h1>
|
|
<p><code>CMS_verify()</code> returns 1 for a successful verification and zero if an error
|
|
occurred.</p>
|
|
<p>CMS_get0_signers() returns all signers or NULL if an error occurred.</p>
|
|
<p>The error can be obtained from <em>ERR_get_error(3)</em></p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="bugs">BUGS</a></h1>
|
|
<p>The trusted certificate store is not searched for the signing certificate,
|
|
this is primarily due to the inadequacies of the current <strong>X509_STORE</strong>
|
|
functionality.</p>
|
|
<p>The lack of single pass processing means that the signed content must all
|
|
be held in memory if it is not detached.</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="see_also">SEE ALSO</a></h1>
|
|
<p><em>ERR_get_error(3)</em>, <em>CMS_sign(3)</em></p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="copyright">COPYRIGHT</a></h1>
|
|
<p>Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.</p>
|
|
<p>Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|