]> git.saurik.com Git - apple/security.git/blob - Keychain/SecKeychainAPI.cpp
50378ea268d5886a1353519134f2b7a1d5732694
[apple/security.git] / Keychain / SecKeychainAPI.cpp
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18 /*
19 * SecKeychainAPI.h
20 * SecurityCore
21 *
22 * Copyright: (c) 2000-2002 by Apple Computer, Inc., all rights reserved
23 *
24 */
25
26 /*!
27 @header SecKeychainAPI The Security Keychain API contains all the APIs need to create a client and Keychain management application. It also contains a certificate, policy, identity and trust management API.
28
29 NOTE: Any function with Create or Copy in the name returns an object that must be released.
30 */
31
32 #include <Security/SecKeychainAPI.h>
33 #include <Security/SecKeychainSearch.h>
34 #include <Security/logging.h>
35
36 OSStatus SecKeychainRelease(SecKeychainRef keychainRef)
37 {
38 if (!keychainRef)
39 return errSecInvalidKeychain;
40
41 CFRelease(keychainRef);
42 return noErr;
43 }
44
45 OSStatus SecKeychainItemRelease(SecKeychainItemRef itemRef)
46 {
47 if (!itemRef)
48 return errSecInvalidItemRef;
49
50 CFRelease(itemRef);
51 return noErr;
52 }
53
54 OSStatus SecKeychainSearchRelease(SecKeychainSearchRef searchRef)
55 {
56 if (!searchRef)
57 return errSecInvalidSearchRef;
58
59 CFRelease(searchRef);
60 return noErr;
61 }
62
63 OSStatus SecKeychainCopySearchNextItem(SecKeychainSearchRef searchRef, SecKeychainItemRef *itemRef)
64 {
65 static bool warnonce;
66 if (!warnonce)
67 {
68 warnonce = true;
69 Syslog::warning("Calling OBSOLETE SecKeychainCopySearchNextItem please use SecKeychainSearchCopyNext instead");
70 }
71
72 return SecKeychainSearchCopyNext(searchRef, itemRef);
73 }