| OLD | NEW |
| (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 #include <string> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "net/base/net_export.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 namespace der { |
| 17 class Input; |
| 18 } |
| 19 |
| 20 // CertErrorParams is a base class for describing extra parameters attached to |
| 21 // a CertErrorNode. |
| 22 // |
| 23 // An example use for parameters is to identify the OID for an unconsumed |
| 24 // critical extension. This parameter could then be pretty printed when |
| 25 // diagnosing the error. |
| 26 class NET_EXPORT CertErrorParams { |
| 27 public: |
| 28 CertErrorParams(); |
| 29 virtual ~CertErrorParams(); |
| 30 |
| 31 // Creates a representation of this parameter as a string, which may be |
| 32 // used for pretty printing the error. |
| 33 virtual std::string ToDebugString() const = 0; |
| 34 |
| 35 // TODO(crbug.com/634443): Add methods to access the underlying |
| 36 // structure, should they be needed for non-pretty-printing use cases. |
| 37 |
| 38 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(CertErrorParams); |
| 40 }; |
| 41 |
| 42 // TODO(crbug.com/634443): Should the underlying parameter classes be exposed |
| 43 // so error consumers can access their data directly? (Without having to go |
| 44 // through the generic virtuals). |
| 45 |
| 46 // Creates a parameter object that holds a copy of |der1|, and names it |name1| |
| 47 // in debug string outputs. |
| 48 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParams1Der( |
| 49 const char* name1, |
| 50 const der::Input& der1); |
| 51 |
| 52 // Same as CreateCertErrorParams1Der() but has a second DER blob. |
| 53 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParams2Der( |
| 54 const char* name1, |
| 55 const der::Input& der1, |
| 56 const char* name2, |
| 57 const der::Input& der2); |
| 58 |
| 59 // Creates a parameter object that holds a single size_t value. |name| is used |
| 60 // when pretty-printing the parameters. |
| 61 NET_EXPORT std::unique_ptr<CertErrorParams> CreateCertErrorParamsSizeT( |
| 62 const char* name, |
| 63 size_t value); |
| 64 |
| 65 } // namespace net |
| 66 |
| 67 #endif // NET_CERT_INTERNAL_CERT_ERROR_PARAMS_H_ |
| OLD | NEW |