summaryrefslogtreecommitdiffstats
path: root/base/crypto/symmetric_key.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/crypto/symmetric_key.h')
-rw-r--r--base/crypto/symmetric_key.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/base/crypto/symmetric_key.h b/base/crypto/symmetric_key.h
index c1e6f97..48b3708 100644
--- a/base/crypto/symmetric_key.h
+++ b/base/crypto/symmetric_key.h
@@ -44,13 +44,12 @@ class SymmetricKey {
size_t iterations,
size_t key_size_in_bits);
-#if defined(USE_NSS) || defined(OS_WIN)
- // TODO(albertb): Port this method to mac.
- // Imports a raw key. For this call to be successful, |raw_key| must have been
- // generated by either GenerateRandomKey or DeriveKeyFromPassword, and
- // must have been exported with GetRawKey. The caller owns the returned
- // SymmetricKey.
- static SymmetricKey* Import(Algorithm algorithm, const std::string& raw_key);
+ // TODO(wtc): port this method to Mac and NSS.
+#if defined(OS_WIN)
+ // Imports a raw key. This method is only used by unit tests.
+ static SymmetricKey* Import(Algorithm algorithm,
+ const void* key_data,
+ size_t key_size_in_bytes);
#endif
#if defined(USE_NSS)
@@ -61,14 +60,13 @@ class SymmetricKey {
HCRYPTKEY key() const { return key_.get(); }
#endif
- // Extracts the raw key from the platform specific data.
- // Warning: |raw_key| holds the raw key as bytes and thus must be handled
- // carefully.
+ // Extracts the raw key from the platform specific data. This should only be
+ // done in unit tests to verify that keys are generated correctly.
bool GetRawKey(std::string* raw_key);
private:
#if defined(USE_NSS)
- explicit SymmetricKey(PK11SymKey* key);
+ explicit SymmetricKey(PK11SymKey* key) : key_(key) {}
ScopedPK11SymKey key_;
#elif defined(OS_MACOSX)
SymmetricKey(const void* key_data, size_t key_size_in_bits);