Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: crypto/apple_keychain.h

Issue 10875029: Rename MacKeychain to AppleKeychain (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address Avi's code review: add NStoCFCast and other nits. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CRYPTO_KEYCHAIN_MAC_H_ 5 #ifndef CRYPTO_KEYCHAIN_MAC_H_
6 #define CRYPTO_KEYCHAIN_MAC_H_ 6 #define CRYPTO_KEYCHAIN_MAC_H_
7 7
8 #include <Security/Security.h> 8 #include <Security/Security.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "crypto/crypto_export.h" 11 #include "crypto/crypto_export.h"
12 12
13 #if defined (OS_IOS)
14 typedef void* SecKeychainRef;
15 typedef void* SecKeychainItemRef;
16 typedef void SecKeychainAttributeList;
17 #endif
18
13 namespace crypto { 19 namespace crypto {
14 20
15 // Wraps the KeychainServices API in a very thin layer, to allow it to be 21 // Wraps the KeychainServices API in a very thin layer, to allow it to be
16 // mocked out for testing. 22 // mocked out for testing.
17 23
18 // See Keychain Services documentation for function documentation, as these call 24 // See Keychain Services documentation for function documentation, as these call
19 // through directly to their Keychain Services equivalents (Foo -> 25 // through directly to their Keychain Services equivalents (Foo ->
20 // SecKeychainFoo). The only exception is Free, which should be used for 26 // SecKeychainFoo). The only exception is Free, which should be used for
21 // anything returned from this class that would normally be freed with 27 // anything returned from this class that would normally be freed with
22 // CFRelease (to aid in testing). 28 // CFRelease (to aid in testing).
23 class CRYPTO_EXPORT MacKeychain { 29 class CRYPTO_EXPORT AppleKeychain {
24 public: 30 public:
25 MacKeychain(); 31 AppleKeychain();
26 virtual ~MacKeychain(); 32 virtual ~AppleKeychain();
27 33
34 virtual OSStatus FindGenericPassword(CFTypeRef keychainOrArray,
35 UInt32 serviceNameLength,
36 const char* serviceName,
37 UInt32 accountNameLength,
38 const char* accountName,
39 UInt32* passwordLength,
40 void** passwordData,
41 SecKeychainItemRef* itemRef) const;
42
43 virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList,
44 void* data) const;
45
46 virtual OSStatus AddGenericPassword(SecKeychainRef keychain,
47 UInt32 serviceNameLength,
48 const char* serviceName,
49 UInt32 accountNameLength,
50 const char* accountName,
51 UInt32 passwordLength,
52 const void* passwordData,
53 SecKeychainItemRef* itemRef) const;
54
55 #if !defined(OS_IOS)
28 virtual OSStatus ItemCopyAttributesAndData( 56 virtual OSStatus ItemCopyAttributesAndData(
29 SecKeychainItemRef itemRef, 57 SecKeychainItemRef itemRef,
30 SecKeychainAttributeInfo* info, 58 SecKeychainAttributeInfo* info,
31 SecItemClass* itemClass, 59 SecItemClass* itemClass,
32 SecKeychainAttributeList** attrList, 60 SecKeychainAttributeList** attrList,
33 UInt32* length, 61 UInt32* length,
34 void** outData) const; 62 void** outData) const;
35 63
36 virtual OSStatus ItemModifyAttributesAndData( 64 virtual OSStatus ItemModifyAttributesAndData(
37 SecKeychainItemRef itemRef, 65 SecKeychainItemRef itemRef,
(...skipping 22 matching lines...) Expand all
60 const char* securityDomain, 88 const char* securityDomain,
61 UInt32 accountNameLength, 89 UInt32 accountNameLength,
62 const char* accountName, 90 const char* accountName,
63 UInt32 pathLength, const char* path, 91 UInt32 pathLength, const char* path,
64 UInt16 port, SecProtocolType protocol, 92 UInt16 port, SecProtocolType protocol,
65 SecAuthenticationType authenticationType, 93 SecAuthenticationType authenticationType,
66 UInt32 passwordLength, 94 UInt32 passwordLength,
67 const void* passwordData, 95 const void* passwordData,
68 SecKeychainItemRef* itemRef) const; 96 SecKeychainItemRef* itemRef) const;
69 97
70 virtual OSStatus FindGenericPassword(CFTypeRef keychainOrArray,
71 UInt32 serviceNameLength,
72 const char* serviceName,
73 UInt32 accountNameLength,
74 const char* accountName,
75 UInt32* passwordLength,
76 void** passwordData,
77 SecKeychainItemRef* itemRef) const;
78
79 virtual OSStatus ItemFreeContent(SecKeychainAttributeList* attrList,
80 void* data) const;
81
82 virtual OSStatus AddGenericPassword(SecKeychainRef keychain,
83 UInt32 serviceNameLength,
84 const char* serviceName,
85 UInt32 accountNameLength,
86 const char* accountName,
87 UInt32 passwordLength,
88 const void* passwordData,
89 SecKeychainItemRef* itemRef) const;
90
91 // Calls CFRelease on the given ref, after checking that |ref| is non-NULL. 98 // Calls CFRelease on the given ref, after checking that |ref| is non-NULL.
92 virtual void Free(CFTypeRef ref) const; 99 virtual void Free(CFTypeRef ref) const;
100 #endif // !defined(OS_IOS)
93 101
94 private: 102 private:
95 DISALLOW_COPY_AND_ASSIGN(MacKeychain); 103 DISALLOW_COPY_AND_ASSIGN(AppleKeychain);
96 }; 104 };
97 105
98 } // namespace crypto 106 } // namespace crypto
99 107
100 #endif // CRYPTO_KEYCHAIN_MAC_H_ 108 #endif // CRYPTO_KEYCHAIN_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_mac_unittest.cc ('k') | crypto/apple_keychain_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698