| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "crypto/crypto_export.h" |
| 12 | 13 |
| 13 namespace crypto { | 14 namespace crypto { |
| 14 | 15 |
| 15 // Wraps the KeychainServices API in a very thin layer, to allow it to be | 16 // Wraps the KeychainServices API in a very thin layer, to allow it to be |
| 16 // mocked out for testing. | 17 // mocked out for testing. |
| 17 | 18 |
| 18 // See Keychain Services documentation for function documentation, as these call | 19 // See Keychain Services documentation for function documentation, as these call |
| 19 // through directly to their Keychain Services equivalents (Foo -> | 20 // through directly to their Keychain Services equivalents (Foo -> |
| 20 // SecKeychainFoo). The only exception is Free, which should be used for | 21 // SecKeychainFoo). The only exception is Free, which should be used for |
| 21 // anything returned from this class that would normally be freed with | 22 // anything returned from this class that would normally be freed with |
| 22 // CFRelease (to aid in testing). | 23 // CFRelease (to aid in testing). |
| 23 class MacKeychain { | 24 class CRYPTO_EXPORT MacKeychain { |
| 24 public: | 25 public: |
| 25 MacKeychain(); | 26 MacKeychain(); |
| 26 virtual ~MacKeychain(); | 27 virtual ~MacKeychain(); |
| 27 | 28 |
| 28 virtual OSStatus ItemCopyAttributesAndData( | 29 virtual OSStatus ItemCopyAttributesAndData( |
| 29 SecKeychainItemRef itemRef, | 30 SecKeychainItemRef itemRef, |
| 30 SecKeychainAttributeInfo* info, | 31 SecKeychainAttributeInfo* info, |
| 31 SecItemClass* itemClass, | 32 SecItemClass* itemClass, |
| 32 SecKeychainAttributeList** attrList, | 33 SecKeychainAttributeList** attrList, |
| 33 UInt32* length, | 34 UInt32* length, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Calls CFRelease on the given ref, after checking that |ref| is non-NULL. | 92 // Calls CFRelease on the given ref, after checking that |ref| is non-NULL. |
| 92 virtual void Free(CFTypeRef ref) const; | 93 virtual void Free(CFTypeRef ref) const; |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(MacKeychain); | 96 DISALLOW_COPY_AND_ASSIGN(MacKeychain); |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace crypto | 99 } // namespace crypto |
| 99 | 100 |
| 100 #endif // CRYPTO_KEYCHAIN_MAC_H_ | 101 #endif // CRYPTO_KEYCHAIN_MAC_H_ |
| OLD | NEW |