]> git.saurik.com Git - apple/security.git/blob - OSX/include/security_keychain/SecNetscapeTemplates.cpp
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / include / security_keychain / SecNetscapeTemplates.cpp
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.cpp - Structs and templates for DER encoding and
24 * decoding of Netscape-style certificate requests
25 * and certificate sequences.
26 */
27
28 #include "SecNetscapeTemplates.h"
29 #include <Security/SecAsn1Templates.h>
30 #include <Security/secasn1t.h>
31 #include <stddef.h>
32
33 const SecAsn1Template NetscapeCertSequenceTemplate[] = {
34 { SEC_ASN1_SEQUENCE,
35 0, NULL, sizeof(NetscapeCertSequence) },
36 { SEC_ASN1_OBJECT_ID,
37 offsetof(NetscapeCertSequence, contentType), 0},
38 { SEC_ASN1_EXPLICIT | SEC_ASN1_CONSTRUCTED |
39 SEC_ASN1_CONTEXT_SPECIFIC | 0 ,
40 offsetof(NetscapeCertSequence, certs),
41 kSecAsn1SequenceOfAnyTemplate },
42 { 0 }
43 };
44 const SecAsn1Template PublicKeyAndChallengeTemplate[] = {
45 { SEC_ASN1_SEQUENCE,
46 0, NULL, sizeof(PublicKeyAndChallenge) },
47 { SEC_ASN1_INLINE,
48 offsetof(PublicKeyAndChallenge, spki),
49 kSecAsn1SubjectPublicKeyInfoTemplate },
50 { SEC_ASN1_INLINE,
51 offsetof(PublicKeyAndChallenge, challenge),
52 kSecAsn1IA5StringTemplate },
53 { 0 }
54 };
55
56 extern const SecAsn1Template SignedPublicKeyAndChallengeTemplate[] = {
57 { SEC_ASN1_SEQUENCE,
58 0, NULL, sizeof(SignedPublicKeyAndChallenge) },
59 { SEC_ASN1_INLINE,
60 offsetof(SignedPublicKeyAndChallenge, pubKeyAndChallenge),
61 PublicKeyAndChallengeTemplate },
62 { SEC_ASN1_INLINE,
63 offsetof(SignedPublicKeyAndChallenge, algId),
64 kSecAsn1AlgorithmIDTemplate },
65 { SEC_ASN1_BIT_STRING,
66 offsetof(SignedPublicKeyAndChallenge, signature) },
67 { 0 }
68 };
69