2 * Copyright (c) 2000-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 * SecPkcs8Templates.cpp - ASN1 templates for private keys in PKCS8 format.
28 #include "SecPkcs8Templates.h"
29 #include <Security/keyTemplates.h>
30 #include <Security/secasn1t.h>
31 #include <security_asn1/prtypes.h>
34 const SecAsn1Template impExpPKCS5_PBE_ParametersTemplate
[] = {
36 0, NULL
, sizeof(impExpPKCS5_PBE_Parameters
) },
37 { SEC_ASN1_OCTET_STRING
,
38 offsetof(impExpPKCS5_PBE_Parameters
,salt
) },
39 /* iterations is unsigned - right? */
41 offsetof(impExpPKCS5_PBE_Parameters
,iterations
) },
45 const SecAsn1Template impExpPKCS5_PBKDF2_ParamsTemplate
[] = {
47 0, NULL
, sizeof(impExpPKCS5_PBKDF2_Params
) },
48 { SEC_ASN1_OCTET_STRING
,
49 offsetof(impExpPKCS5_PBKDF2_Params
,salt
) },
50 /* iterations is unsigned - right? */
52 offsetof(impExpPKCS5_PBKDF2_Params
,iterationCount
) },
53 { SEC_ASN1_INTEGER
| SEC_ASN1_OPTIONAL
,
54 offsetof(impExpPKCS5_PBKDF2_Params
,keyLengthInBytes
) },
55 { SEC_ASN1_OBJECT_ID
| SEC_ASN1_OPTIONAL
,
56 offsetof(impExpPKCS5_PBKDF2_Params
,prf
) },
60 const SecAsn1Template impExpPKCS5_RC2ParamsTemplate
[] = {
62 0, NULL
, sizeof(impExpPKCS5_RC2Params
) },
63 { SEC_ASN1_INTEGER
| SEC_ASN1_OPTIONAL
,
64 offsetof(impExpPKCS5_RC2Params
,version
) },
65 { SEC_ASN1_OCTET_STRING
,
66 offsetof(impExpPKCS5_RC2Params
,iv
) },
70 const SecAsn1Template impExpPKCS5_RC5ParamsTemplate
[] = {
72 0, NULL
, sizeof(impExpPKCS5_RC5Params
) },
74 offsetof(impExpPKCS5_RC5Params
,version
) },
76 offsetof(impExpPKCS5_RC5Params
,rounds
) },
78 offsetof(impExpPKCS5_RC5Params
,blockSizeInBits
) },
79 { SEC_ASN1_OCTET_STRING
,
80 offsetof(impExpPKCS5_RC5Params
,iv
) },
84 const SecAsn1Template impExpPKCS5_PBES2_ParamsTemplate
[] = {
86 0, NULL
, sizeof(impExpPKCS5_PBES2_Params
) },
88 offsetof(impExpPKCS5_PBES2_Params
,keyDerivationFunc
),
89 kSecAsn1AlgorithmIDTemplate
},
91 offsetof(impExpPKCS5_PBES2_Params
,encryptionScheme
),
92 kSecAsn1AlgorithmIDTemplate
},