Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Side by Side Diff: net/cert/internal/cert_error_params.h

Issue 2329593002: Add optional context for certificate errors. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_INTERNAL_CERT_ERROR_PARAMS_H_
6 #define NET_CERT_INTERNAL_CERT_ERROR_PARAMS_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "net/base/net_export.h"
12
13 namespace net {
14
15 namespace der {
16 class Input;
17 }
18
19 // CertErrorParams is a base class for describing extra parameters attached to
20 // a CertErrorNode.
21 //
22 // An example use for parameters is to identify the OID for an unconsumed
23 // critical extension. This parameter could then be pretty printed when
24 // diagnosing the error.
25 class NET_EXPORT CertErrorParams {
eroman 2016/09/09 20:36:52 This is a move to its own file, however I also cha
26 public:
27 CertErrorParams();
28 virtual ~CertErrorParams();
29
30 // Creates a representation of this parameter as a string, which may be
31 // used for pretty printing the error.
32 virtual std::string ToDebugString() const = 0;
33
34 // TODO(crbug.com/634443): Add methods to access the underlying
35 // structure, should they be needed for non-pretty-printing use cases.
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(CertErrorParams);
39 };
40
41 // TODO(crbug.com/634443): Should the underlying parameter classes be exposed
42 // so error consumers can access their data directly? (Without having to go
43 // through the generic virtuals).
44
45 // Creates a parameter object that holds a copy of |der1|, and names it |name1|
46 // in debug string outputs.
47 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParams1Der(
48 const char* name1,
49 const der::Input& der1);
50
51 // Same as CreateCertErrorParams1Der() but has a second DER blob.
52 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParams2Der(
53 const char* name1,
54 const der::Input& der1,
55 const char* name2,
56 const der::Input& der2);
57
58 // Creates a parameter object that holds a single size_t value. |name| is used
59 // when pretty-printing the parameters.
60 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParamsSizeT(
61 const char* name,
62 size_t value);
63
64 } // namespace net
65
66 #endif // NET_CERT_INTERNAL_CERT_ERROR_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698