blob: 72007883ffd30412df734e10528dfa71960e3d78 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright 2014 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 QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_ENCRYPTER_H_
6#define QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_ENCRYPTER_H_
7
QUICHE team2d187972019-03-19 16:23:47 -07008#include "net/third_party/quiche/src/quic/core/crypto/chacha_base_encrypter.h"
QUICHE teama6ef0a62019-03-07 20:34:33 -05009#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
10
11namespace quic {
12
13// A ChaCha20Poly1305Encrypter is a QuicEncrypter that implements the
14// AEAD_CHACHA20_POLY1305 algorithm specified in RFC 7539, except that
15// it truncates the Poly1305 authenticator to 12 bytes. Create an instance
16// by calling QuicEncrypter::Create(kCC20).
17//
18// It uses an authentication tag of 12 bytes (96 bits). The fixed prefix of the
19// nonce is four bytes.
QUICHE team2d187972019-03-19 16:23:47 -070020class QUIC_EXPORT_PRIVATE ChaCha20Poly1305Encrypter
21 : public ChaChaBaseEncrypter {
QUICHE teama6ef0a62019-03-07 20:34:33 -050022 public:
23 enum {
24 kAuthTagSize = 12,
25 };
26
27 ChaCha20Poly1305Encrypter();
28 ChaCha20Poly1305Encrypter(const ChaCha20Poly1305Encrypter&) = delete;
29 ChaCha20Poly1305Encrypter& operator=(const ChaCha20Poly1305Encrypter&) =
30 delete;
31 ~ChaCha20Poly1305Encrypter() override;
32};
33
34} // namespace quic
35
36#endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA20_POLY1305_ENCRYPTER_H_