Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CRYPTO_AEAD_H_ | |
| 6 #define CRYPTO_AEAD_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/strings/string_piece.h" | |
| 11 #include "crypto/crypto_export.h" | |
| 12 | |
| 13 namespace crypto { | |
| 14 | |
| 15 extern const size_t kAeadKeyLength; | |
|
agl
2015/04/21 20:28:26
these would have to be properties of |Aead|.
estark
2015/04/22 03:55:31
Oops, these are actually dead. Removed.
| |
| 16 extern const size_t kAeadNonceLength; | |
| 17 | |
| 18 // This class exposes the AES-128-CTR-HMAC-SHA256 AEAD, currently only | |
| 19 // for OpenSSL builds. | |
| 20 class CRYPTO_EXPORT Aead { | |
| 21 public: | |
| 22 explicit Aead(const std::string* key); | |
|
estark
2015/04/18 05:24:42
Wasn't sure if this should take an algorithm param
agl
2015/04/21 20:28:26
It should, and the KeyLength and NonceLength() bec
estark
2015/04/22 03:55:31
Done.
| |
| 23 | |
| 24 ~Aead(); | |
| 25 | |
| 26 bool Seal(const base::StringPiece& plaintext, | |
|
agl
2015/04/21 20:28:26
addition data argument?
estark
2015/04/22 03:55:30
Done.
| |
| 27 const base::StringPiece& nonce, | |
| 28 std::string* ciphertext); | |
| 29 | |
| 30 bool Open(const base::StringPiece& ciphertext, | |
| 31 const base::StringPiece& nonce, | |
| 32 std::string* plaintext); | |
| 33 | |
| 34 static size_t KeyLength(); | |
| 35 | |
| 36 static size_t NonceLength(); | |
| 37 | |
| 38 private: | |
| 39 const std::string* key_; | |
| 40 }; | |
| 41 | |
| 42 } // namespace crypto | |
| 43 | |
| 44 #endif // CRYPTO_ENCRYPTOR_H_ | |
| OLD | NEW |