1//
2//  der_plist.h
3//  utilities
4//
5//  Created by Mitch Adler on 6/18/12.
6//  Copyright (c) 2012 Apple Inc. All rights reserved.
7//
8
9#ifndef _DER_PLIST_H_
10#define _DER_PLIST_H_
11
12#include <CoreFoundation/CoreFoundation.h>
13
14//
15// Error Codes for PropertyList <-> DER
16//
17
18static const CFIndex kSecDERErrorUnknownEncoding = -1;
19static const CFIndex kSecDERErrorUnsupportedCFObject = -2;
20static const CFIndex kSecDERErrorUnsupportedDERType = -2;
21static const CFIndex kSecDERErrorAllocationFailure = -3;
22static const CFIndex kSecDERErrorUnsupportedNumberType = -4;
23
24static const CFIndex kSecDERErrorUnderlyingError = -100;
25
26extern CFStringRef sSecDERErrorDomain;
27
28// PropertyList <-> DER Functions
29
30size_t der_sizeof_plist(CFPropertyListRef pl, CFErrorRef *error);
31
32uint8_t* der_encode_plist(CFPropertyListRef pl, CFErrorRef *error,
33                           const uint8_t *der, uint8_t *der_end);
34
35const uint8_t* der_decode_plist(CFAllocatorRef pl, CFOptionFlags mutability,
36                                CFPropertyListRef* cf, CFErrorRef *error,
37                                const uint8_t* der, const uint8_t *der_end);
38
39#endif
40