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

Side by Side Diff: net/cert/asn1_util.h

Issue 517083002: Enable Certificate Transparency in the OpenSSL port. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ct-objects-extractor
Patch Set: move comment Created 6 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CERT_ASN1_UTIL_H_ 5 #ifndef NET_CERT_ASN1_UTIL_H_
6 #define NET_CERT_ASN1_UTIL_H_ 6 #define NET_CERT_ASN1_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace asn1 { 15 namespace asn1 {
16 16
17 // These are the DER encodings of the tag byte for ASN.1 objects. 17 // These are the DER encodings of the tag byte for ASN.1 objects.
18 static const unsigned kBOOLEAN = 0x01; 18 static const unsigned kBOOLEAN = 0x01;
19 static const unsigned kINTEGER = 0x02; 19 static const unsigned kINTEGER = 0x02;
20 static const unsigned kBITSTRING = 0x03; 20 static const unsigned kBITSTRING = 0x03;
21 static const unsigned kOCTETSTRING = 0x04; 21 static const unsigned kOCTETSTRING = 0x04;
22 static const unsigned kOID = 0x06; 22 static const unsigned kOID = 0x06;
23 static const unsigned kENUMERATED = 0x0A;
23 static const unsigned kSEQUENCE = 0x30; 24 static const unsigned kSEQUENCE = 0x30;
24 25
25 // These are flags that can be ORed with the above tag numbers. 26 // These are flags that can be ORed with the above tag numbers.
26 static const unsigned kContextSpecific = 0x80; 27 static const unsigned kContextSpecific = 0x80;
27 static const unsigned kConstructed = 0x20; 28 static const unsigned kConstructed = 0x20;
28 29
29 // kAny matches any tag value; 30 // kAny matches any tag value;
30 static const unsigned kAny = 0x10000; 31 static const unsigned kAny = 0x10000;
31 // kOptional denotes an optional element. 32 // kOptional denotes an optional element.
32 static const unsigned kOptional = 0x20000; 33 static const unsigned kOptional = 0x20000;
(...skipping 13 matching lines...) Expand all
46 bool ParseElement(base::StringPiece* in, 47 bool ParseElement(base::StringPiece* in,
47 unsigned tag_value, 48 unsigned tag_value,
48 base::StringPiece* out, 49 base::StringPiece* out,
49 unsigned *out_header_len); 50 unsigned *out_header_len);
50 51
51 // GetElement performs the same actions as ParseElement, except that the header 52 // GetElement performs the same actions as ParseElement, except that the header
52 // bytes are not included in the output. 53 // bytes are not included in the output.
53 // 54 //
54 // If |tag_value & kOptional| is true then this function cannot distinguish 55 // If |tag_value & kOptional| is true then this function cannot distinguish
55 // between a missing optional element and an empty one. 56 // between a missing optional element and an empty one.
56 bool GetElement(base::StringPiece* in, 57 NET_EXPORT_PRIVATE bool GetElement(base::StringPiece* in,
57 unsigned tag_value, 58 unsigned tag_value,
58 base::StringPiece* out); 59 base::StringPiece* out);
59 60
60 // ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and 61 // ExtractSPKIFromDERCert parses the DER encoded certificate in |cert| and
61 // extracts the bytes of the SubjectPublicKeyInfo. On successful return, 62 // extracts the bytes of the SubjectPublicKeyInfo. On successful return,
62 // |spki_out| is set to contain the SPKI, pointing into |cert|. 63 // |spki_out| is set to contain the SPKI, pointing into |cert|.
63 NET_EXPORT_PRIVATE bool ExtractSPKIFromDERCert(base::StringPiece cert, 64 NET_EXPORT_PRIVATE bool ExtractSPKIFromDERCert(base::StringPiece cert,
64 base::StringPiece* spki_out); 65 base::StringPiece* spki_out);
65 66
66 // ExtractSubjectPublicKeyFromSPKI parses the DER encoded SubjectPublicKeyInfo 67 // ExtractSubjectPublicKeyFromSPKI parses the DER encoded SubjectPublicKeyInfo
67 // in |spki| and extracts the bytes of the SubjectPublicKey. On successful 68 // 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 // return, |spk_out| is set to contain the public key, pointing into |spki|.
(...skipping 15 matching lines...) Expand all
84 // several locations as far as a CRL filter is concerned. 85 // several locations as far as a CRL filter is concerned.
85 NET_EXPORT_PRIVATE bool ExtractCRLURLsFromDERCert( 86 NET_EXPORT_PRIVATE bool ExtractCRLURLsFromDERCert(
86 base::StringPiece cert, 87 base::StringPiece cert,
87 std::vector<base::StringPiece>* urls_out); 88 std::vector<base::StringPiece>* urls_out);
88 89
89 } // namespace asn1 90 } // namespace asn1
90 91
91 } // namespace net 92 } // namespace net
92 93
93 #endif // NET_CERT_ASN1_UTIL_H_ 94 #endif // NET_CERT_ASN1_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698