]> git.saurik.com Git - apple/security.git/blob - OSX/utilities/src/der_plist_internal.h
Security-57740.31.2.tar.gz
[apple/security.git] / OSX / utilities / src / der_plist_internal.h
1 /*
2 * Copyright (c) 2012-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
24
25 #ifndef _DER_PLIST_INTERNAL_H_
26 #define _DER_PLIST_INTERNAL_H_
27
28 #include <CoreFoundation/CoreFoundation.h>
29
30 // Always returns false, to satisfy static analysis
31 bool SecCFDERCreateError(CFIndex errorCode, CFStringRef descriptionString, CFErrorRef previousError, CFErrorRef *newError);
32
33
34 // CFArray <-> DER
35 size_t der_sizeof_array(CFArrayRef array, CFErrorRef *error);
36
37 uint8_t* der_encode_array(CFArrayRef array, CFErrorRef *error,
38 const uint8_t *der, uint8_t *der_end);
39
40 const uint8_t* der_decode_array(CFAllocatorRef allocator, CFOptionFlags mutability,
41 CFArrayRef* array, CFErrorRef *error,
42 const uint8_t* der, const uint8_t *der_end);
43
44 // CFNull <-> DER
45 size_t der_sizeof_null(CFNullRef nul, CFErrorRef *error);
46
47 uint8_t* der_encode_null(CFNullRef nul, CFErrorRef *error,
48 const uint8_t *der, uint8_t *der_end);
49
50 const uint8_t* der_decode_null(CFAllocatorRef allocator, CFOptionFlags mutability,
51 CFNullRef *nul, CFErrorRef *error,
52 const uint8_t* der, const uint8_t *der_end);
53
54
55 // CFBoolean <-> DER
56 size_t der_sizeof_boolean(CFBooleanRef boolean, CFErrorRef *error);
57
58 uint8_t* der_encode_boolean(CFBooleanRef boolean, CFErrorRef *error,
59 const uint8_t *der, uint8_t *der_end);
60
61 const uint8_t* der_decode_boolean(CFAllocatorRef allocator, CFOptionFlags mutability,
62 CFBooleanRef* boolean, CFErrorRef *error,
63 const uint8_t* der, const uint8_t *der_end);
64
65 // CFData <-> DER
66 size_t der_sizeof_data(CFDataRef data, CFErrorRef *error);
67
68 uint8_t* der_encode_data(CFDataRef data, CFErrorRef *error,
69 const uint8_t *der, uint8_t *der_end);
70
71 const uint8_t* der_decode_data(CFAllocatorRef allocator, CFOptionFlags mutability,
72 CFDataRef* data, CFErrorRef *error,
73 const uint8_t* der, const uint8_t *der_end);
74
75 const uint8_t* der_decode_data_mutable(CFAllocatorRef allocator, CFOptionFlags mutability,
76 CFMutableDataRef* data, CFErrorRef *error,
77 const uint8_t* der, const uint8_t *der_end);
78
79
80 // CFDate <-> DER
81 size_t der_sizeof_date(CFDateRef date, CFErrorRef *error);
82
83 uint8_t* der_encode_date(CFDateRef date, CFErrorRef *error,
84 const uint8_t *der, uint8_t *der_end);
85
86 const uint8_t* der_decode_date(CFAllocatorRef allocator, CFOptionFlags mutability,
87 CFDateRef* date, CFErrorRef *error,
88 const uint8_t* der, const uint8_t *der_end);
89
90
91 // CFDictionary <-> DER
92 size_t der_sizeof_dictionary(CFDictionaryRef dictionary, CFErrorRef *error);
93
94 uint8_t* der_encode_dictionary(CFDictionaryRef dictionary, CFErrorRef *error,
95 const uint8_t *der, uint8_t *der_end);
96
97 const uint8_t* der_decode_dictionary(CFAllocatorRef allocator, CFOptionFlags mutability,
98 CFDictionaryRef* dictionary, CFErrorRef *error,
99 const uint8_t* der, const uint8_t *der_end);
100
101 // CFNumber <-> DER
102 // Currently only supports signed 64 bit values. No floating point.
103 size_t der_sizeof_number(CFNumberRef number, CFErrorRef *error);
104
105 uint8_t* der_encode_number(CFNumberRef number, CFErrorRef *error,
106 const uint8_t *der, uint8_t *der_end);
107
108 const uint8_t* der_decode_number(CFAllocatorRef allocator, CFOptionFlags mutability,
109 CFNumberRef* number, CFErrorRef *error,
110 const uint8_t* der, const uint8_t *der_end);
111
112 // CFString <-> DER
113 size_t der_sizeof_string(CFStringRef string, CFErrorRef *error);
114
115 uint8_t* der_encode_string(CFStringRef string, CFErrorRef *error,
116 const uint8_t *der, uint8_t *der_end);
117
118 const uint8_t* der_decode_string(CFAllocatorRef allocator, CFOptionFlags mutability,
119 CFStringRef* string, CFErrorRef *error,
120 const uint8_t* der, const uint8_t *der_end);
121
122 // CFSet <-> DER
123 size_t der_sizeof_set(CFSetRef dict, CFErrorRef *error);
124
125 uint8_t* der_encode_set(CFSetRef set, CFErrorRef *error,
126 const uint8_t *der, uint8_t *der_end);
127
128 const uint8_t* der_decode_set(CFAllocatorRef allocator, CFOptionFlags mutability,
129 CFSetRef* set, CFErrorRef *error,
130 const uint8_t* der, const uint8_t *der_end);
131
132 #include <corecrypto/ccder.h>
133 enum {
134 CCDER_CONSTRUCTED_CFSET = CCDER_PRIVATE | CCDER_SET,
135 };
136
137 #endif