| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ | 5 #ifndef NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
| 6 #define NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ | 6 #define NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
| 7 | 7 |
| 8 #include "net/base/net_export.h" | 8 #include "net/base/net_export.h" |
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // encrypter). |output| must be as long as |ciphertext| on entry and, on | 45 // encrypter). |output| must be as long as |ciphertext| on entry and, on |
| 46 // successful return, the true length of the plaintext will be written to | 46 // successful return, the true length of the plaintext will be written to |
| 47 // |*output_length|. | 47 // |*output_length|. |
| 48 virtual bool Decrypt(base::StringPiece nonce, | 48 virtual bool Decrypt(base::StringPiece nonce, |
| 49 base::StringPiece associated_data, | 49 base::StringPiece associated_data, |
| 50 base::StringPiece ciphertext, | 50 base::StringPiece ciphertext, |
| 51 unsigned char* output, | 51 unsigned char* output, |
| 52 size_t* output_length) = 0; | 52 size_t* output_length) = 0; |
| 53 | 53 |
| 54 // Returns a newly created QuicData object containing the decrypted | 54 // Returns a newly created QuicData object containing the decrypted |
| 55 // |ciphertext| or NULL if there is an error. |sequence_number| is | 55 // |ciphertext| or nullptr if there is an error. |sequence_number| is |
| 56 // appended to the |nonce_prefix| value provided in SetNoncePrefix() | 56 // appended to the |nonce_prefix| value provided in SetNoncePrefix() |
| 57 // to form the nonce. | 57 // to form the nonce. |
| 58 // TODO(wtc): add a way for DecryptPacket to report decryption failure due | 58 // TODO(wtc): add a way for DecryptPacket to report decryption failure due |
| 59 // to non-authentic inputs, as opposed to other reasons for failure. | 59 // to non-authentic inputs, as opposed to other reasons for failure. |
| 60 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, | 60 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, |
| 61 base::StringPiece associated_data, | 61 base::StringPiece associated_data, |
| 62 base::StringPiece ciphertext) = 0; | 62 base::StringPiece ciphertext) = 0; |
| 63 | 63 |
| 64 // For use by unit tests only. | 64 // For use by unit tests only. |
| 65 virtual base::StringPiece GetKey() const = 0; | 65 virtual base::StringPiece GetKey() const = 0; |
| 66 virtual base::StringPiece GetNoncePrefix() const = 0; | 66 virtual base::StringPiece GetNoncePrefix() const = 0; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace net | 69 } // namespace net |
| 70 | 70 |
| 71 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ | 71 #endif // NET_QUIC_CRYPTO_QUIC_DECRYPTER_H_ |
| OLD | NEW |