1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "crypto/apple_keychain.h"
7 #import <Foundation/Foundation.h>
11 AppleKeychain::AppleKeychain() {}
13 AppleKeychain::~AppleKeychain() {}
15 OSStatus AppleKeychain::ItemCopyAttributesAndData(
16 SecKeychainItemRef itemRef,
17 SecKeychainAttributeInfo* info,
18 SecItemClass* itemClass,
19 SecKeychainAttributeList** attrList,
21 void** outData) const {
22 return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass,
23 attrList, length, outData);
26 OSStatus AppleKeychain::ItemModifyAttributesAndData(
27 SecKeychainItemRef itemRef,
28 const SecKeychainAttributeList* attrList,
30 const void* data) const {
31 return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length,
35 OSStatus AppleKeychain::ItemFreeAttributesAndData(
36 SecKeychainAttributeList* attrList,
38 return SecKeychainItemFreeAttributesAndData(attrList, data);
41 OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
42 return SecKeychainItemDelete(itemRef);
45 OSStatus AppleKeychain::SearchCreateFromAttributes(
46 CFTypeRef keychainOrArray,
47 SecItemClass itemClass,
48 const SecKeychainAttributeList* attrList,
49 SecKeychainSearchRef* searchRef) const {
50 return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass,
54 OSStatus AppleKeychain::SearchCopyNext(SecKeychainSearchRef searchRef,
55 SecKeychainItemRef* itemRef) const {
56 return SecKeychainSearchCopyNext(searchRef, itemRef);
59 OSStatus AppleKeychain::AddInternetPassword(
60 SecKeychainRef keychain,
61 UInt32 serverNameLength,
62 const char* serverName,
63 UInt32 securityDomainLength,
64 const char* securityDomain,
65 UInt32 accountNameLength,
66 const char* accountName,
70 SecProtocolType protocol,
71 SecAuthenticationType authenticationType,
72 UInt32 passwordLength,
73 const void* passwordData,
74 SecKeychainItemRef* itemRef) const {
75 return SecKeychainAddInternetPassword(keychain,
76 serverNameLength, serverName,
77 securityDomainLength, securityDomain,
78 accountNameLength, accountName,
80 port, protocol, authenticationType,
81 passwordLength, passwordData,
85 OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
86 UInt32 serviceNameLength,
87 const char* serviceName,
88 UInt32 accountNameLength,
89 const char* accountName,
90 UInt32* passwordLength,
92 SecKeychainItemRef* itemRef) const {
93 return SecKeychainFindGenericPassword(keychainOrArray,
103 OSStatus AppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
105 return SecKeychainItemFreeContent(attrList, data);
108 OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain,
109 UInt32 serviceNameLength,
110 const char* serviceName,
111 UInt32 accountNameLength,
112 const char* accountName,
113 UInt32 passwordLength,
114 const void* passwordData,
115 SecKeychainItemRef* itemRef) const {
116 return SecKeychainAddGenericPassword(keychain,
126 void AppleKeychain::Free(CFTypeRef ref) const {
131 } // namespace crypto