Disable failing TabsTest to investigate
[chromium-blink-merge.git] / crypto / aead_openssl.h
blob773cce1428686b26be80ba7076d97214f3c90bcc
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.
5 #ifndef CRYPTO_AEAD_H_
6 #define CRYPTO_AEAD_H_
8 #include "base/strings/string_piece.h"
9 #include "crypto/crypto_export.h"
11 struct evp_aead_st;
13 namespace crypto {
15 // This class exposes the AES-128-CTR-HMAC-SHA256 AEAD, currently only
16 // for OpenSSL builds.
17 class CRYPTO_EXPORT Aead {
18 public:
19 enum AeadAlgorithm { AES_128_CTR_HMAC_SHA256 };
21 explicit Aead(AeadAlgorithm algorithm);
23 ~Aead();
25 void Init(const std::string* key);
27 bool Seal(const base::StringPiece& plaintext,
28 const base::StringPiece& nonce,
29 const base::StringPiece& additional_data,
30 std::string* ciphertext) const;
32 bool Open(const base::StringPiece& ciphertext,
33 const base::StringPiece& nonce,
34 const base::StringPiece& additional_data,
35 std::string* plaintext) const;
37 size_t KeyLength() const;
39 size_t NonceLength() const;
41 private:
42 const std::string* key_;
43 const evp_aead_st* aead_;
46 } // namespace crypto
48 #endif // CRYPTO_ENCRYPTOR_H_