OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 NET_QUIC_CRYPTO_QUIC_ENCRYPTER_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_ENCRYPTER_H_ |
| 7 |
| 8 #include "net/quic/crypto/crypto_protocol.h" |
| 9 #include "net/quic/quic_protocol.h" |
| 10 |
| 11 namespace net { |
| 12 |
| 13 class QuicEncrypter { |
| 14 public: |
| 15 virtual ~QuicEncrypter() {} |
| 16 |
| 17 static QuicEncrypter* Create(CryptoTag algorithm); |
| 18 |
| 19 // Returns a newly created QuicData object containing the encrypted |
| 20 // |plaintext| as well as a MAC over both |plaintext| and |associated_data|, |
| 21 // or NULL if there is an error. |
| 22 virtual QuicData* Encrypt(base::StringPiece associated_data, |
| 23 base::StringPiece plaintext) = 0; |
| 24 |
| 25 // Returns the maximum length of plaintext that can be encrypted |
| 26 // to ciphertext no larger than |ciphertext_size|. |
| 27 virtual size_t GetMaxPlaintextSize(size_t ciphertext_size) = 0; |
| 28 |
| 29 // Returns the length of the ciphertext that would be generated by encrypting |
| 30 // to plaintext of size |plaintext_size|. |
| 31 virtual size_t GetCiphertextSize(size_t plaintext_size) = 0; |
| 32 |
| 33 }; |
| 34 |
| 35 } // namespace net |
| 36 |
| 37 #endif // NET_QUIC_CRYPTO_QUIC_ENCRYPTER_H_ |
OLD | NEW |