OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "crypto/symmetric_key.h" | 5 #include "crypto/symmetric_key.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // versa. Note that BoringSSL does not support AES-192. | 93 // versa. Note that BoringSSL does not support AES-192. |
94 if (raw_key.size() != 128/8 && raw_key.size() != 256/8) | 94 if (raw_key.size() != 128/8 && raw_key.size() != 256/8) |
95 return nullptr; | 95 return nullptr; |
96 } | 96 } |
97 | 97 |
98 std::unique_ptr<SymmetricKey> key(new SymmetricKey); | 98 std::unique_ptr<SymmetricKey> key(new SymmetricKey); |
99 key->key_ = raw_key; | 99 key->key_ = raw_key; |
100 return key; | 100 return key; |
101 } | 101 } |
102 | 102 |
103 bool SymmetricKey::GetRawKey(std::string* raw_key) const { | |
104 *raw_key = key_; | |
105 return true; | |
106 } | |
107 | |
108 SymmetricKey::SymmetricKey() = default; | 103 SymmetricKey::SymmetricKey() = default; |
109 | 104 |
110 } // namespace crypto | 105 } // namespace crypto |
OLD | NEW |