OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_ASN1_UTIL_H_ | 5 #ifndef NET_BASE_ASN1_UTIL_H_ |
6 #define NET_BASE_ASN1_UTIL_H_ | 6 #define NET_BASE_ASN1_UTIL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 bool GetElement(base::StringPiece* in, | 56 bool GetElement(base::StringPiece* in, |
57 unsigned tag_value, | 57 unsigned tag_value, |
58 base::StringPiece* out); | 58 base::StringPiece* out); |
59 | 59 |
60 // ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and | 60 // ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and |
61 // extracts the bytes of the SubjectPublicKeyInfo. On successful return, | 61 // extracts the bytes of the SubjectPublicKeyInfo. On successful return, |
62 // |spki_out| is set to contain the SPKI, pointing into |cert|. | 62 // |spki_out| is set to contain the SPKI, pointing into |cert|. |
63 NET_EXPORT_PRIVATE bool ExtractSPKIFromDERCert(base::StringPiece cert, | 63 NET_EXPORT_PRIVATE bool ExtractSPKIFromDERCert(base::StringPiece cert, |
64 base::StringPiece* spki_out); | 64 base::StringPiece* spki_out); |
65 | 65 |
| 66 // ExtractSubjectPublicKeyFromSPKI parses the DER encoded SubjectPublicKeyInfo |
| 67 // in |spki| and extracts the bytes of the SubjectPublicKey. On successful |
| 68 // return, |spk_out| is set to contain the public key, pointing into |spki|. |
| 69 NET_EXPORT_PRIVATE bool ExtractSubjectPublicKeyFromSPKI( |
| 70 base::StringPiece spki, |
| 71 base::StringPiece* spk_out); |
| 72 |
66 // ExtractCRLURLsFromDERCert parses the DER encoded certificate in |cert| and | 73 // ExtractCRLURLsFromDERCert parses the DER encoded certificate in |cert| and |
67 // extracts the URL of each CRL. On successful return, the elements of | 74 // extracts the URL of each CRL. On successful return, the elements of |
68 // |urls_out| point into |cert|. | 75 // |urls_out| point into |cert|. |
69 // | 76 // |
70 // CRLs that only cover a subset of the reasons are omitted as the spec | 77 // CRLs that only cover a subset of the reasons are omitted as the spec |
71 // requires that at least one CRL be included that covers all reasons. | 78 // requires that at least one CRL be included that covers all reasons. |
72 // | 79 // |
73 // CRLs that use an alternative issuer are also omitted. | 80 // CRLs that use an alternative issuer are also omitted. |
74 // | 81 // |
75 // The nested set of GeneralNames is flattened into a single list because | 82 // The nested set of GeneralNames is flattened into a single list because |
76 // having several CRLs with one location is equivalent to having one CRL with | 83 // having several CRLs with one location is equivalent to having one CRL with |
77 // several locations as far as a CRL filter is concerned. | 84 // several locations as far as a CRL filter is concerned. |
78 NET_EXPORT_PRIVATE bool ExtractCRLURLsFromDERCert( | 85 NET_EXPORT_PRIVATE bool ExtractCRLURLsFromDERCert( |
79 base::StringPiece cert, | 86 base::StringPiece cert, |
80 std::vector<base::StringPiece>* urls_out); | 87 std::vector<base::StringPiece>* urls_out); |
81 | 88 |
82 } // namespace asn1 | 89 } // namespace asn1 |
83 | 90 |
84 } // namespace net | 91 } // namespace net |
85 | 92 |
86 #endif // NET_BASE_ASN1_UTIL_H_ | 93 #endif // NET_BASE_ASN1_UTIL_H_ |
OLD | NEW |