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

Unified Diff: net/cert/internal/parse_certificate.h

Issue 1969293002: Remove net::ParsedCertificate struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cast_certificate/cast_cert_validator.cc ('k') | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/parse_certificate.h
diff --git a/net/cert/internal/parse_certificate.h b/net/cert/internal/parse_certificate.h
index 8ea235cc30ce4b373e58579709efd20023e9b88b..d3c4d975b260f1ae71140f4b2ef560371055f678 100644
--- a/net/cert/internal/parse_certificate.h
+++ b/net/cert/internal/parse_certificate.h
@@ -16,7 +16,6 @@
namespace net {
-struct ParsedCertificate;
struct ParsedTbsCertificate;
// Returns true if the given serial number (CertificateSerialNumber in RFC 5280)
@@ -47,24 +46,44 @@ struct ParsedTbsCertificate;
NET_EXPORT bool VerifySerialNumber(const der::Input& value) WARN_UNUSED_RESULT;
// Parses a DER-encoded "Certificate" as specified by RFC 5280. Returns true on
-// success and sets the results in |out|.
+// success and sets the results in the |out_*| parameters.
//
-// Note that on success |out| aliases data from the input |certificate_tlv|.
-// Hence the fields of the ParsedCertificate are only valid as long as
+// Note that on success the out parameters alias data from the input
+// |certificate_tlv|. Hence the output values are only valid as long as
// |certificate_tlv| remains valid.
//
-// On failure |out| has an undefined state. Some of its fields may have been
-// updated during parsing, whereas others may not have been changed.
-//
-// Refer to the per-field documention of the ParsedCertificate structure for
-// details on what validity checks parsing performs.
+// On failure the out parameters have an undefined state. Some of them may have
+// been updated during parsing, whereas others may not have been changed.
//
+// The out parameters represent each field of the Certificate SEQUENCE:
// Certificate ::= SEQUENCE {
-// tbsCertificate TBSCertificate,
-// signatureAlgorithm AlgorithmIdentifier,
-// signatureValue BIT STRING }
+//
+// The |out_tbs_certificate_tlv| parameter corresponds with "tbsCertificate"
+// from RFC 5280:
+// tbsCertificate TBSCertificate,
+//
+// This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
+// guarantees are made regarding the value of this SEQUENCE.
+// This can be further parsed using ParseTbsCertificate().
+//
+// The |out_signature_algorithm_tlv| parameter corresponds with
+// "signatureAlgorithm" from RFC 5280:
+// signatureAlgorithm AlgorithmIdentifier,
+//
+// This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
+// guarantees are made regarding the value of this SEQUENCE.
+// This can be further parsed using SignatureValue::CreateFromDer().
+//
+// The |out_signature_value| parameter corresponds with "signatureValue" from
+// RFC 5280:
+// signatureValue BIT STRING }
+//
+// Parsing guarantees that this is a valid BIT STRING.
NET_EXPORT bool ParseCertificate(const der::Input& certificate_tlv,
- ParsedCertificate* out) WARN_UNUSED_RESULT;
+ der::Input* out_tbs_certificate_tlv,
+ der::Input* out_signature_algorithm_tlv,
+ der::BitString* out_signature_value)
+ WARN_UNUSED_RESULT;
// Parses a DER-encoded "TBSCertificate" as specified by RFC 5280. Returns true
// on success and sets the results in |out|.
@@ -106,40 +125,6 @@ enum class CertificateVersion {
V3,
};
-// ParsedCertificate contains pointers to the main fields of a DER-encoded RFC
-// 5280 "Certificate".
-//
-// ParsedCertificate is expected to be filled by ParseCertificate(), so
-// subsequent field descriptions are in terms of what ParseCertificate() sets.
-struct NET_EXPORT ParsedCertificate {
- ParsedCertificate();
- ~ParsedCertificate();
-
- // Corresponds with "tbsCertificate" from RFC 5280:
- // tbsCertificate TBSCertificate,
- //
- // This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
- // guarantees are made regarding the value of this SEQUENCE.
- //
- // This can be further parsed using ParseTbsCertificate().
- der::Input tbs_certificate_tlv;
-
- // Corresponds with "signatureAlgorithm" from RFC 5280:
- // signatureAlgorithm AlgorithmIdentifier,
- //
- // This contains the full (unverified) Tag-Length-Value for a SEQUENCE. No
- // guarantees are made regarding the value of this SEQUENCE.
- //
- // This can be further parsed using SignatureValue::CreateFromDer().
- der::Input signature_algorithm_tlv;
-
- // Corresponds with "signatureValue" from RFC 5280:
- // signatureValue BIT STRING }
- //
- // Parsing guarantees that this is a valid BIT STRING.
- der::BitString signature_value;
-};
-
// ParsedTbsCertificate contains pointers to the main fields of a DER-encoded
// RFC 5280 "TBSCertificate".
//
« no previous file with comments | « components/cast_certificate/cast_cert_validator.cc ('k') | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698