]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/lib/SecNetscapeTemplates.h
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecNetscapeTemplates.h
1 /*
2 * Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 *
23 * SecNetscapeTemplates.h - Structs and templates for DER encoding and
24 * decoding of Netscape-style certificate requests
25 * and certificate sequences.
26 */
27
28 #ifndef _SEC_IMPORT_EXPORT_NETSCAPE_TEMPLATES_H_
29 #define _SEC_IMPORT_EXPORT_NETSCAPE_TEMPLATES_H_
30
31 #include <Security/secasn1t.h>
32 #include <Security/cssmtype.h>
33 #include <Security/X509Templates.h>
34 #include <Security/keyTemplates.h>
35 #include <Security/x509defs.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 /*
42 * Netscape Certifiate Sequence is defined by Netscape as a PKCS7
43 * ContentInfo with a contentType of netscape-cert-sequence and a content
44 * consisting of a sequence of certificates.
45 *
46 * For simplicity - i.e., to avoid the general purpose ContentInfo
47 * polymorphism - we'll just hard-code this particular type right here.
48 *
49 * Inside the ContentInfo is an array of standard X509 certificates.
50 * We don't need to parse the certs themselves so they remain as
51 * opaque data blobs.
52 */
53 typedef struct {
54 CSSM_OID contentType; // netscape-cert-sequence
55 CSSM_DATA **certs;
56 } NetscapeCertSequence;
57
58 extern const SecAsn1Template NetscapeCertSequenceTemplate[];
59
60 /*
61 * Public key/challenge, to send to CA.
62 *
63 * PublicKeyAndChallenge ::= SEQUENCE {
64 *
65 *   spki SubjectPublicKeyInfo,
66 * challenge IA5STRING
67 * }
68 *
69 * SignedPublicKeyAndChallenge ::= SEQUENCE {
70 * publicKeyAndChallenge PublicKeyAndChallenge,
71 * signatureAlgorithm AlgorithmIdentifier,
72 * signature BIT STRING
73 * }
74 */
75 typedef struct {
76 CSSM_X509_SUBJECT_PUBLIC_KEY_INFO spki;
77 CSSM_DATA challenge; // ASCII
78 } PublicKeyAndChallenge;
79
80 typedef struct {
81 PublicKeyAndChallenge pubKeyAndChallenge;
82 CSSM_X509_ALGORITHM_IDENTIFIER algId;
83 CSSM_DATA signature; // length in BITS
84 } SignedPublicKeyAndChallenge;
85
86 extern const SecAsn1Template PublicKeyAndChallengeTemplate[];
87 extern const SecAsn1Template SignedPublicKeyAndChallengeTemplate[];
88
89 #ifdef __cplusplus
90 }
91 #endif
92
93 #endif /* _SEC_IMPORT_EXPORT_NETSCAPE_TEMPLATES_H_ */
94