2 * Copyright (c) 2003-2004,2008,2010,2012 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@
27 #ifndef _PKCS7_TEMPLATES_H_
28 #define _PKCS7_TEMPLATES_H_
30 #include <Security/SecAsn1Types.h>
37 * DigestInfo ::= SEQUENCE {
38 * digestAlgorithm DigestAlgorithmIdentifier,
42 * Digest ::= OCTET STRING
45 SecAsn1AlgId digestAlgorithm
;
49 extern const SecAsn1Template NSS_P7_DigestInfoTemplate
[];
52 * Uninterpreted ContentInfo, with content stripped from its
53 * EXPLICIT CONTEXT_SPECIFIC wrapper
55 * ContentInfo ::= SEQUENCE {
56 * contentType ContentType,
57 * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
61 SecAsn1Oid contentType
;
63 } NSS_P7_RawContentInfo
;
65 extern const SecAsn1Template NSS_P7_RawContentInfoTemplate
[];
67 // MARK: ---- ContentInfo.content types -----
70 * Expand beyond ASN_ANY/CSSM_DATA as needed
72 typedef SecAsn1Item NSS_P7_SignedData
;
73 typedef SecAsn1Item NSS_P7_EnvelData
;
74 typedef SecAsn1Item NSS_P7_SignEnvelData
;
75 typedef SecAsn1Item NSS_P7_DigestedData
;
80 * EncryptedContentInfo ::= SEQUENCE {
81 * contentType ContentType,
82 * contentEncryptionAlgorithm
83 * ContentEncryptionAlgorithmIdentifier,
85 * [0] IMPLICIT EncryptedContent OPTIONAL
88 * EncryptedContent ::= OCTET STRING
92 SecAsn1Oid contentType
;
94 SecAsn1Item encrContent
;
95 } NSS_P7_EncrContentInfo
;
98 * EncryptedData ::= SEQUENCE {
100 * encryptedContentInfo EncryptedContentInfo
105 NSS_P7_EncrContentInfo contentInfo
;
106 } NSS_P7_EncryptedData
;
108 extern const SecAsn1Template NSS_P7_EncrContentInfoTemplate
[];
109 extern const SecAsn1Template NSS_P7_EncryptedDataTemplate
[];
110 extern const SecAsn1Template NSS_P7_PtrToEncryptedDataTemplate
[];
112 /* the stub templates for unimplemented contentTypes */
113 #define NSS_P7_PtrToSignedDataTemplate kSecAsn1PointerToAnyTemplate
114 #define NSS_P7_PtrToEnvelDataTemplate kSecAsn1PointerToAnyTemplate
115 #define NSS_P7_PtrToSignEnvelDataTemplate kSecAsn1PointerToAnyTemplate
116 #define NSS_P7_PtrToDigestedDataTemplate kSecAsn1PointerToAnyTemplate
118 // MARK: ---- decoded ContentInfo -----
121 * For convenience, out dynamic template chooser for ContentInfo.content
122 * drops one of these into the decoded struct. Thus, higher level
123 * code doesn't have to grunge around comparing OIDs to figure out
137 * Decoded ContentInfo. Decoded via SEC_ASN1_DYNAMIC per contentType.
140 SecAsn1Oid contentType
;
143 SecAsn1Item
*data
; // CSSMOID_PKCS7_Data
144 // contents of Octet String
145 NSS_P7_SignedData
*signedData
;
146 // CSSMOID_PKCS7_SignedData
147 NSS_P7_EnvelData
*envData
; // CSSMOID_PKCS7_EnvelopedData
148 NSS_P7_SignEnvelData
*signEnvelData
;
149 // CSSMOID_PKCS7_SignedAndEnvelopedData
150 NSS_P7_DigestedData
*digestedData
;
151 // CSSMOID_PKCS7_DigestedData
152 NSS_P7_EncryptedData
*encryptData
;
153 //CSSMOID_PKCS7_EncryptedData
156 } NSS_P7_DecodedContentInfo
;
158 extern const SecAsn1Template NSS_P7_DecodedContentInfoTemplate
[];
164 #endif /* _PKCS7_TEMPLATES_H_ */