| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_CRYPTO_COMMON_CERT_SET_H_ |
| 6 #define NET_QUIC_CRYPTO_COMMON_CERT_SET_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/strings/string_piece.h" |
| 11 #include "net/base/net_export.h" |
| 12 #include "net/quic/crypto/crypto_protocol.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 // CommonCertSet is an interface to an object that contains a number of common |
| 17 // certificate sets and can match against them. |
| 18 class NET_EXPORT_PRIVATE CommonCertSet { |
| 19 public: |
| 20 virtual ~CommonCertSet(); |
| 21 |
| 22 // GetCommonHashes returns a StringPiece containing the hashes of common sets |
| 23 // supported by this object. |
| 24 virtual base::StringPiece GetCommonHashes() = 0; |
| 25 |
| 26 // GetCert returns a specific certificate in the common set identified by |
| 27 // |hash|. If no such certificate is known, an empty StringPiece is returned. |
| 28 virtual base::StringPiece GetCert(uint64 hash, uint32 index) = 0; |
| 29 |
| 30 // MatchCert tries to find |cert| in one of the common certificate sets |
| 31 // identified by |common_set_hashes|. On success it puts the hash in |
| 32 // |out_hash|, the index in the set in |out_index| and returns true. Otherwise |
| 33 // it returns false. |
| 34 virtual bool MatchCert(base::StringPiece cert, |
| 35 base::StringPiece common_set_hashes, |
| 36 uint64* out_hash, |
| 37 uint32* out_index) = 0; |
| 38 }; |
| 39 |
| 40 // CommonCertSetQUIC implements the CommonCertSet interface using the default |
| 41 // certificate sets. |
| 42 class NET_EXPORT_PRIVATE CommonCertSetQUIC : public CommonCertSet { |
| 43 public: |
| 44 CommonCertSetQUIC(); |
| 45 |
| 46 // CommonCertSet interface. |
| 47 virtual base::StringPiece GetCommonHashes() OVERRIDE; |
| 48 |
| 49 virtual base::StringPiece GetCert(uint64 hash, uint32 index) OVERRIDE; |
| 50 |
| 51 virtual bool MatchCert(base::StringPiece cert, |
| 52 base::StringPiece common_set_hashes, |
| 53 uint64* out_hash, |
| 54 uint32* out_index) OVERRIDE; |
| 55 |
| 56 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(CommonCertSetQUIC); |
| 58 }; |
| 59 |
| 60 } // namespace net |
| 61 |
| 62 #endif // NET_QUIC_CRYPTO_COMMON_CERT_SET_H_ |
| OLD | NEW |