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

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

Issue 1288193003: Add a function for parsing RFC 5280's "Certificate". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_helpers
Patch Set: Wrap comments in .pem files Created 5 years, 4 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 | « net/BUILD.gn ('k') | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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_PARSE_CERTIFICATE_H_
6 #define NET_CERT_INTERNAL_PARSE_CERTIFICATE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "net/base/net_export.h"
11 #include "net/der/input.h"
12 #include "net/der/parse_values.h"
13
14 namespace net {
15
16 struct ParsedCertificate;
17
18 // Parses a DER-encoded "Certificate" as specified by RFC 5280. Returns true on
19 // success and sets the results in |out|.
davidben 2015/08/14 17:50:42 Oh! One more thing that occurred to me that's actu
20 //
21 // Refer to the per-field documention of the ParsedCertificate structure for
22 // details on what validity checks parsing performs.
23 //
24 // Certificate ::= SEQUENCE {
25 // tbsCertificate TBSCertificate,
26 // signatureAlgorithm AlgorithmIdentifier,
27 // signatureValue BIT STRING }
28 NET_EXPORT bool ParseCertificate(const der::Input& certificate_tlv,
29 ParsedCertificate* out) WARN_UNUSED_RESULT;
30
31 // ParsedCertificate contains pointers to the main fields of a DER-encoded RFC
32 // 5280 "Certificate".
33 //
34 // ParsedCertificate is expected to be filled by ParseCertificate(), so
35 // subsequent field descriptions are in terms of what ParseCertificate() sets.
36 struct NET_EXPORT ParsedCertificate {
37 // Corresponds with "tbsCertificate" from RFC 5280:
38 // tbsCertificate TBSCertificate,
39 //
40 // This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
41 // guarantees are made regarding the value of this SEQUENCE.
42 der::Input tbs_certificate_tlv;
43
44 // Corresponds with "signatureAlgorithm" from RFC 5280:
45 // signatureAlgorithm AlgorithmIdentifier,
46 //
47 // This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
48 // guarantees are made regarding the value of this SEQUENCE.
49 //
50 // This can be further parsed using SignatureValue::CreateFromDer().
51 der::Input signature_algorithm_tlv;
52
53 // Corresponds with "signatureValue" from RFC 5280:
54 // signatureValue BIT STRING }
55 //
56 // Parsing guarantees that this is a valid BIT STRING.
57 der::BitString signature_value;
58 };
59
60 } // namespace net
61
62 #endif // NET_CERT_INTERNAL_PARSE_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698