1/*
2 * Copyright (c) 2003-2008 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 @header SecBasePriv
26 SecBasePriv contains private error codes for the Security framework.
27 */
28#ifndef _SECURITY_SECBASEPRIV_H_
29#define _SECURITY_SECBASEPRIV_H_
30
31#include <CoreFoundation/CFBase.h>
32#include <Security/cssmtype.h>
33
34#if defined(__cplusplus)
35extern "C" {
36#endif
37
38/*******************************************************
39 *** Private OSStatus values unique to Security APIs ***
40 *******************************************************/
41
42/*
43    Note: the comments that appear after these errors are used to create SecErrorMessages.strings.
44    The comments must not be multi-line, and should be in a form meaningful to an end user. If
45    a different or additional comment is needed, it can be put in the header doc format, or on a
46    line that does not start with errZZZ.
47*/
48
49enum
50{
51	priv_errSecUnimplemented     = -4,		/* Private version of errSecUnimplemented constant. */
52	priv_errSecParam             = -50,		/* Private version of errSecParam constant. */
53	priv_errSecDecode            = -26275,	/* Private version of errSecDecode constant. */
54};
55
56enum
57{
58    errSecInvalidCertificate     = priv_errSecDecode, // -26265,  /* This certificate could not be decoded. */
59    errSecPolicyDenied			 = -26270,  /* The certificate chain was not trusted due to a policy not accepting it. */
60    errSecInvalidKey             = priv_errSecDecode, // -26274,  /* The provided key material was not valid. */
61    errSecInternal               = -26276,  /* An internal error occured in the Security framework. */
62    errSecUnsupportedAlgorithm   = priv_errSecUnimplemented, // -26268,  /* An unsupported algorithm was encountered. */
63    errSecUnsupportedOperation   = priv_errSecUnimplemented, // -26271,  /* The operation you requested is not supported by this key. */
64    errSecUnsupportedPadding     = priv_errSecParam, // -26273,  /* The padding you requested is not supported. */
65    errSecItemInvalidKey         = priv_errSecParam, // -34000,  /* A string key in dictionary is not one of the supported keys. */
66    errSecItemInvalidKeyType     = priv_errSecParam, // -34001,  /* A key in a dictionary is neither a CFStringRef nor a CFNumberRef. */
67    errSecItemInvalidValue       = priv_errSecParam, // -34002,  /* A value in a dictionary is an invalid (or unsupported) CF type. */
68    errSecItemClassMissing       = priv_errSecParam, // -34003,  /* No kSecItemClass key was specified in a dictionary. */
69    errSecItemMatchUnsupported   = priv_errSecParam, // -34004,  /* The caller passed one or more kSecMatch keys to a function which does not support matches. */
70    errSecUseItemListUnsupported = priv_errSecParam, // -34005,  /* The caller passed in a kSecUseItemList key to a function which does not support it. */
71    errSecUseKeychainUnsupported = priv_errSecParam, // -34006,  /* The caller passed in a kSecUseKeychain key to a function which does not support it. */
72    errSecUseKeychainListUnsupported = priv_errSecParam, // -34007,  /* The caller passed in a kSecUseKeychainList key to a function which does not support it. */
73    errSecReturnDataUnsupported  = priv_errSecParam, // -34008,  /* The caller passed in a kSecReturnData key to a function which does not support it. */
74    errSecReturnAttributesUnsupported = priv_errSecParam, // -34009,  /* The caller passed in a kSecReturnAttributes key to a function which does not support it. */
75    errSecReturnRefUnsupported   = priv_errSecParam, // -34010,  /* The caller passed in a kSecReturnRef key to a function which does not support it. */
76    errSecValueRefUnsupported    = priv_errSecParam, // -34012,  /* The caller passed in a kSecValueRef key to a function which does not support it. */
77    errSecValuePersistentRefUnsupported = priv_errSecParam, // -34013,  /* The caller passed in a kSecValuePersistentRef key to a function which does not support it. */
78    errSecReturnMissingPointer   = priv_errSecParam, // -34014,  /* The caller passed asked for something to be returned but did not pass in a result pointer. */
79	errSecMatchLimitUnsupported  = priv_errSecParam, // -34015,  /* The caller passed in a kSecMatchLimit key to a call which does not support limits. */
80	errSecItemIllegalQuery       = priv_errSecParam, // -34016,  /* The caller passed in a query which contained too many keys. */
81};
82
83const char *cssmErrorString(CSSM_RETURN error);
84
85OSStatus SecKeychainErrFromOSStatus(OSStatus osStatus);
86
87#if defined(__cplusplus)
88}
89#endif
90
91#endif /* !_SECURITY_SECBASEPRIV_H_ */
92