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

Side by Side Diff: base/crypto/symmetric_key.h

Issue 4777001: Implements encryptor_openssl.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 BASE_CRYPTO_SYMMETRIC_KEY_H_ 5 #ifndef BASE_CRYPTO_SYMMETRIC_KEY_H_
6 #define BASE_CRYPTO_SYMMETRIC_KEY_H_ 6 #define BASE_CRYPTO_SYMMETRIC_KEY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const std::string& salt, 44 const std::string& salt,
45 size_t iterations, 45 size_t iterations,
46 size_t key_size_in_bits); 46 size_t key_size_in_bits);
47 47
48 // Imports a raw key. For this call to be successful, |raw_key| must have been 48 // Imports a raw key. For this call to be successful, |raw_key| must have been
49 // generated by either GenerateRandomKey or DeriveKeyFromPassword, and 49 // generated by either GenerateRandomKey or DeriveKeyFromPassword, and
50 // must have been exported with GetRawKey. The caller owns the returned 50 // must have been exported with GetRawKey. The caller owns the returned
51 // SymmetricKey. 51 // SymmetricKey.
52 static SymmetricKey* Import(Algorithm algorithm, const std::string& raw_key); 52 static SymmetricKey* Import(Algorithm algorithm, const std::string& raw_key);
53 53
54 #if defined(USE_NSS) 54 #if defined(USE_OPENSSL)
55 const std::string& key() { return key_; }
56 #elif defined(USE_NSS)
55 PK11SymKey* key() const { return key_.get(); } 57 PK11SymKey* key() const { return key_.get(); }
56 #elif defined(OS_MACOSX) 58 #elif defined(OS_MACOSX)
57 CSSM_DATA cssm_data() const; 59 CSSM_DATA cssm_data() const;
58 #elif defined(OS_WIN) 60 #elif defined(OS_WIN)
59 HCRYPTKEY key() const { return key_.get(); } 61 HCRYPTKEY key() const { return key_.get(); }
60 #endif 62 #endif
61 63
62 // Extracts the raw key from the platform specific data. 64 // Extracts the raw key from the platform specific data.
63 // Warning: |raw_key| holds the raw key as bytes and thus must be handled 65 // Warning: |raw_key| holds the raw key as bytes and thus must be handled
64 // carefully. 66 // carefully.
(...skipping 25 matching lines...) Expand all
90 // fails with NTE_BAD_KEY/NTE_BAD_LEN 92 // fails with NTE_BAD_KEY/NTE_BAD_LEN
91 std::string raw_key_; 93 std::string raw_key_;
92 #endif 94 #endif
93 95
94 DISALLOW_COPY_AND_ASSIGN(SymmetricKey); 96 DISALLOW_COPY_AND_ASSIGN(SymmetricKey);
95 }; 97 };
96 98
97 } // namespace base 99 } // namespace base
98 100
99 #endif // BASE_CRYPTO_SYMMETRIC_KEY_H_ 101 #endif // BASE_CRYPTO_SYMMETRIC_KEY_H_
OLDNEW
« base/crypto/encryptor_openssl.cc ('K') | « base/crypto/encryptor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698