2 * Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 @header SecCmsSignedData.h
26 @Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved.
28 @availability 10.4 and later
29 @abstract Interfaces of the CMS implementation.
30 @discussion The functions here implement functions for encoding
31 and decoding Cryptographic Message Syntax (CMS) objects
32 as described in rfc3369.
35 #ifndef _SECURITY_SECCMSSIGNEDDATA_H_
36 #define _SECURITY_SECCMSSIGNEDDATA_H_ 1
38 #include <Security/SecCmsBase.h>
39 #include <Security/SecTrust.h>
42 #if defined(__cplusplus)
48 @abstract Create a new SecCmsSignedData object.
49 @param cmsg Pointer to a SecCmsMessage in which this SecCmsSignedData
52 extern SecCmsSignedDataRef
53 SecCmsSignedDataCreate(SecCmsMessageRef cmsg
);
59 SecCmsSignedDataDestroy(SecCmsSignedDataRef sigd
);
63 @abstract Retrieve the SignedData's signer list.
65 extern SecCmsSignerInfoRef
*
66 SecCmsSignedDataGetSignerInfos(SecCmsSignedDataRef sigd
);
72 SecCmsSignedDataSignerInfoCount(SecCmsSignedDataRef sigd
);
77 extern SecCmsSignerInfoRef
78 SecCmsSignedDataGetSignerInfo(SecCmsSignedDataRef sigd
, int i
);
82 @abstract Retrieve the SignedData's digest algorithm list.
84 extern SECAlgorithmID
**
85 SecCmsSignedDataGetDigestAlgs(SecCmsSignedDataRef sigd
);
89 @abstract Return pointer to this signedData's contentinfo.
91 extern SecCmsContentInfoRef
92 SecCmsSignedDataGetContentInfo(SecCmsSignedDataRef sigd
);
96 @discussion XXX Should be obsoleted.
99 SecCmsSignedDataImportCerts(SecCmsSignedDataRef sigd
, SecKeychainRef keychain
,
100 SECCertUsage certusage
, Boolean keepcerts
);
104 @abstract See if we have digests in place.
107 SecCmsSignedDataHasDigests(SecCmsSignedDataRef sigd
);
111 @abstract Check the signatures.
112 @discussion The digests were either calculated during decoding (and are stored in the
113 signedData itself) or set after decoding using SecCmsSignedDataSetDigests.
115 The verification checks if the signing cert is valid and has a trusted chain
116 for the purpose specified by "policies".
118 If trustRef is NULL the cert chain is verified and the VerificationStatus is set accordingly.
119 Otherwise a SecTrust object is returned for the caller to evaluate using SecTrustEvaluate().
122 SecCmsSignedDataVerifySignerInfo(SecCmsSignedDataRef sigd
, int i
, SecKeychainRef keychainOrArray
,
123 CFTypeRef policies
, SecTrustRef
*trustRef
);
127 @abstract Verify the certs in a certs-only message.
130 SecCmsSignedDataVerifyCertsOnly(SecCmsSignedDataRef sigd
,
131 SecKeychainRef keychainOrArray
,
138 SecCmsSignedDataAddCertList(SecCmsSignedDataRef sigd
, CFArrayRef certlist
);
142 @abstract Add cert and its entire chain to the set of certs.
145 SecCmsSignedDataAddCertChain(SecCmsSignedDataRef sigd
, SecCertificateRef cert
);
151 SecCmsSignedDataAddCertificate(SecCmsSignedDataRef sigd
, SecCertificateRef cert
);
157 SecCmsSignedDataContainsCertsOrCrls(SecCmsSignedDataRef sigd
);
161 @abstract Retrieve the SignedData's certificate list.
163 extern CSSM_DATA_PTR
*
164 SecCmsSignedDataGetCertificateList(SecCmsSignedDataRef sigd
);
170 SecCmsSignedDataAddSignerInfo(SecCmsSignedDataRef sigd
,
171 SecCmsSignerInfoRef signerinfo
);
177 SecCmsSignedDataSetDigests(SecCmsSignedDataRef sigd
,
178 SECAlgorithmID
**digestalgs
,
179 CSSM_DATA_PTR
*digests
);
183 @abstract Create a certs-only SignedData.
184 @param cert Base certificate that will be included
185 @param include_chain If true, include the complete cert chain for cert.
186 @discussion More certs and chains can be added via AddCertificate and AddCertChain.
187 @result An error results in a return value of NULL and an error set.
189 extern SecCmsSignedDataRef
190 SecCmsSignedDataCreateCertsOnly(SecCmsMessageRef cmsg
, SecCertificateRef cert
, Boolean include_chain
);
193 #if defined(__cplusplus)
197 #endif /* _SECURITY_SECCMSSIGNEDDATA_H_ */