| OLD | NEW |
| (Empty) |
| 1 // 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 NET_CERT_CRL_SET_STORAGE_H_ | |
| 6 #define NET_CERT_CRL_SET_STORAGE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <utility> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/strings/string_piece.h" | |
| 13 #include "net/base/net_export.h" | |
| 14 #include "net/cert/crl_set.h" | |
| 15 | |
| 16 namespace base { | |
| 17 class DictionaryValue; | |
| 18 } | |
| 19 | |
| 20 namespace net { | |
| 21 | |
| 22 // Static helpers to save and load CRLSet. | |
| 23 class NET_EXPORT CRLSetStorage { | |
| 24 public: | |
| 25 // Parse parses the bytes in |data| and, on success, puts a new CRLSet in | |
| 26 // |out_crl_set| and returns true. | |
| 27 static bool Parse(base::StringPiece data, | |
| 28 scoped_refptr<CRLSet>* out_crl_set); | |
| 29 | |
| 30 // ApplyDelta returns a new CRLSet in |out_crl_set| that is the result of | |
| 31 // updating |in_crl_set| with the delta information in |delta_bytes|. | |
| 32 static bool ApplyDelta(const CRLSet* in_crl_set, | |
| 33 const base::StringPiece& delta_bytes, | |
| 34 scoped_refptr<CRLSet>* out_crl_set); | |
| 35 | |
| 36 // GetIsDeltaUpdate extracts the header from |bytes|, sets *is_delta to | |
| 37 // whether |bytes| is a delta CRL set or not and returns true. In the event | |
| 38 // of a parse error, it returns false. | |
| 39 static bool GetIsDeltaUpdate(const base::StringPiece& bytes, bool *is_delta); | |
| 40 | |
| 41 // Serialize returns a string of bytes suitable for passing to Parse. Parsing | |
| 42 // and serializing a CRLSet is a lossless operation - the resulting bytes | |
| 43 // will be equal. | |
| 44 static std::string Serialize(const CRLSet* crl_set); | |
| 45 | |
| 46 private: | |
| 47 // CopyBlockedSPKIsFromHeader sets |blocked_spkis_| to the list of values | |
| 48 // from "BlockedSPKIs" in |header_dict|. | |
| 49 static bool CopyBlockedSPKIsFromHeader(CRLSet* crl_set, | |
| 50 base::DictionaryValue* header_dict); | |
| 51 }; | |
| 52 | |
| 53 } // namespace net | |
| 54 | |
| 55 #endif // NET_CERT_CRL_SET_STORAGE_H_ | |
| OLD | NEW |