summaryrefslogtreecommitdiffstats
path: root/crypto/apple_keychain_mac.mm
diff options
context:
space:
mode:
authormsarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 13:03:46 +0000
committermsarda@chromium.org <msarda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 13:03:46 +0000
commit982f1ab97f266866f5ea7cdf7980fb8c2685a713 (patch)
tree260c13aad3c10eb298e9d076917ba461a289b971 /crypto/apple_keychain_mac.mm
parent57ed6c2888e68e0baa6919cee16b3c4726552e09 (diff)
downloadchromium_src-982f1ab97f266866f5ea7cdf7980fb8c2685a713.zip
chromium_src-982f1ab97f266866f5ea7cdf7980fb8c2685a713.tar.gz
chromium_src-982f1ab97f266866f5ea7cdf7980fb8c2685a713.tar.bz2
Rename MacKeychain to AppleKeychain
Rename MacKeychain to AppleKeychain and add mac and iOS specific implementations (crypto/apple_keychain_ios.mm and crypto/apple_keychain_mac.mm). Rename MockKeychain to MockAppleKeychain and split its implementations in 3 files crypto/mock_apple_keychain.cc, crypto/mock_apple_keychain_ios.cc and crypto/mock_apple_keychain_mac.cc). Review URL: https://chromiumcodereview.appspot.com/10875029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/apple_keychain_mac.mm')
-rw-r--r--crypto/apple_keychain_mac.mm131
1 files changed, 131 insertions, 0 deletions
diff --git a/crypto/apple_keychain_mac.mm b/crypto/apple_keychain_mac.mm
new file mode 100644
index 0000000..545be19
--- /dev/null
+++ b/crypto/apple_keychain_mac.mm
@@ -0,0 +1,131 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "crypto/apple_keychain.h"
+
+#import <Foundation/Foundation.h>
+
+namespace crypto {
+
+AppleKeychain::AppleKeychain() {}
+
+AppleKeychain::~AppleKeychain() {}
+
+OSStatus AppleKeychain::ItemCopyAttributesAndData(
+ SecKeychainItemRef itemRef,
+ SecKeychainAttributeInfo* info,
+ SecItemClass* itemClass,
+ SecKeychainAttributeList** attrList,
+ UInt32* length,
+ void** outData) const {
+ return SecKeychainItemCopyAttributesAndData(itemRef, info, itemClass,
+ attrList, length, outData);
+}
+
+OSStatus AppleKeychain::ItemModifyAttributesAndData(
+ SecKeychainItemRef itemRef,
+ const SecKeychainAttributeList* attrList,
+ UInt32 length,
+ const void* data) const {
+ return SecKeychainItemModifyAttributesAndData(itemRef, attrList, length,
+ data);
+}
+
+OSStatus AppleKeychain::ItemFreeAttributesAndData(
+ SecKeychainAttributeList* attrList,
+ void* data) const {
+ return SecKeychainItemFreeAttributesAndData(attrList, data);
+}
+
+OSStatus AppleKeychain::ItemDelete(SecKeychainItemRef itemRef) const {
+ return SecKeychainItemDelete(itemRef);
+}
+
+OSStatus AppleKeychain::SearchCreateFromAttributes(
+ CFTypeRef keychainOrArray,
+ SecItemClass itemClass,
+ const SecKeychainAttributeList* attrList,
+ SecKeychainSearchRef* searchRef) const {
+ return SecKeychainSearchCreateFromAttributes(keychainOrArray, itemClass,
+ attrList, searchRef);
+}
+
+OSStatus AppleKeychain::SearchCopyNext(SecKeychainSearchRef searchRef,
+ SecKeychainItemRef* itemRef) const {
+ return SecKeychainSearchCopyNext(searchRef, itemRef);
+}
+
+OSStatus AppleKeychain::AddInternetPassword(
+ SecKeychainRef keychain,
+ UInt32 serverNameLength,
+ const char* serverName,
+ UInt32 securityDomainLength,
+ const char* securityDomain,
+ UInt32 accountNameLength,
+ const char* accountName,
+ UInt32 pathLength,
+ const char* path,
+ UInt16 port,
+ SecProtocolType protocol,
+ SecAuthenticationType authenticationType,
+ UInt32 passwordLength,
+ const void* passwordData,
+ SecKeychainItemRef* itemRef) const {
+ return SecKeychainAddInternetPassword(keychain,
+ serverNameLength, serverName,
+ securityDomainLength, securityDomain,
+ accountNameLength, accountName,
+ pathLength, path,
+ port, protocol, authenticationType,
+ passwordLength, passwordData,
+ itemRef);
+}
+
+OSStatus AppleKeychain::FindGenericPassword(CFTypeRef keychainOrArray,
+ UInt32 serviceNameLength,
+ const char* serviceName,
+ UInt32 accountNameLength,
+ const char* accountName,
+ UInt32* passwordLength,
+ void** passwordData,
+ SecKeychainItemRef* itemRef) const {
+ return SecKeychainFindGenericPassword(keychainOrArray,
+ serviceNameLength,
+ serviceName,
+ accountNameLength,
+ accountName,
+ passwordLength,
+ passwordData,
+ itemRef);
+}
+
+OSStatus AppleKeychain::ItemFreeContent(SecKeychainAttributeList* attrList,
+ void* data) const {
+ return SecKeychainItemFreeContent(attrList, data);
+}
+
+OSStatus AppleKeychain::AddGenericPassword(SecKeychainRef keychain,
+ UInt32 serviceNameLength,
+ const char* serviceName,
+ UInt32 accountNameLength,
+ const char* accountName,
+ UInt32 passwordLength,
+ const void* passwordData,
+ SecKeychainItemRef* itemRef) const {
+ return SecKeychainAddGenericPassword(keychain,
+ serviceNameLength,
+ serviceName,
+ accountNameLength,
+ accountName,
+ passwordLength,
+ passwordData,
+ itemRef);
+}
+
+void AppleKeychain::Free(CFTypeRef ref) const {
+ if (ref)
+ CFRelease(ref);
+}
+
+} // namespace crypto