OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ |
6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "net/base/net_export.h" | 16 #include "net/quic/platform/api/quic_export.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 class QuicRandom; | 20 class QuicRandom; |
21 | 21 |
22 // CryptoSecretBoxer encrypts small chunks of plaintext (called 'boxing') and | 22 // CryptoSecretBoxer encrypts small chunks of plaintext (called 'boxing') and |
23 // then, later, can authenticate+decrypt the resulting boxes. This object is | 23 // then, later, can authenticate+decrypt the resulting boxes. This object is |
24 // thread-safe. | 24 // thread-safe. |
25 class NET_EXPORT_PRIVATE CryptoSecretBoxer { | 25 class QUIC_EXPORT_PRIVATE CryptoSecretBoxer { |
26 public: | 26 public: |
27 CryptoSecretBoxer(); | 27 CryptoSecretBoxer(); |
28 ~CryptoSecretBoxer(); | 28 ~CryptoSecretBoxer(); |
29 | 29 |
30 // GetKeySize returns the number of bytes in a key. | 30 // GetKeySize returns the number of bytes in a key. |
31 static size_t GetKeySize(); | 31 static size_t GetKeySize(); |
32 | 32 |
33 // used by |Box|, but all supplied keys will be tried by |Unbox|, to handle | 33 // used by |Box|, but all supplied keys will be tried by |Unbox|, to handle |
34 // key skew across the fleet. This must be called before |Box| or |Unbox|. | 34 // key skew across the fleet. This must be called before |Box| or |Unbox|. |
35 // Keys must be |GetKeySize()| bytes long. | 35 // Keys must be |GetKeySize()| bytes long. |
(...skipping 18 matching lines...) Expand all Loading... |
54 mutable base::Lock lock_; | 54 mutable base::Lock lock_; |
55 // GUARDED_BY(lock_).mutable Mutex lock_; | 55 // GUARDED_BY(lock_).mutable Mutex lock_; |
56 std::vector<std::string> keys_; | 56 std::vector<std::string> keys_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(CryptoSecretBoxer); | 58 DISALLOW_COPY_AND_ASSIGN(CryptoSecretBoxer); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace net | 61 } // namespace net |
62 | 62 |
63 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ | 63 #endif // NET_QUIC_CORE_CRYPTO_CRYPTO_SECRET_BOXER_H_ |
OLD | NEW |