Enable -Wl,-z,defs for ozone builds
[chromium-blink-merge.git] / net / cert / crl_set_storage.h
blobdd15796aa5be5daa0ac2b4e22b874d210f42607a
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.
5 #ifndef NET_CERT_CRL_SET_STORAGE_H_
6 #define NET_CERT_CRL_SET_STORAGE_H_
8 #include <string>
9 #include <utility>
10 #include <vector>
12 #include "base/strings/string_piece.h"
13 #include "net/base/net_export.h"
14 #include "net/cert/crl_set.h"
16 namespace base {
17 class DictionaryValue;
20 namespace net {
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);
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);
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);
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);
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);
53 } // namespace net
55 #endif // NET_CERT_CRL_SET_STORAGE_H_