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

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

Issue 1214933009: Class for parsing and evaluating RFC 5280 NameConstraints. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compare_DN2
Patch Set: win compile fix Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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_INTERNAL_VERIFY_NAME_MATCH_H_ 5 #ifndef NET_CERT_INTERNAL_VERIFY_NAME_MATCH_H_
6 #define NET_CERT_INTERNAL_VERIFY_NAME_MATCH_H_ 6 #define NET_CERT_INTERNAL_VERIFY_NAME_MATCH_H_
7 7
8 #include "base/compiler_specific.h"
8 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
9 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
10 11
11 namespace net { 12 namespace net {
12 13
13 namespace der { 14 namespace der {
14 class Input; 15 class Input;
15 } // namespace der 16 } // namespace der
16 17
17 // Compare DER-encoded X.501 Name values according to RFC 5280 rules. 18 // Compares DER-encoded X.501 Name values according to RFC 5280 rules.
18 // |a_rdn_sequence| and |b_rdn_sequence| should be the DER-encoded RDNSequence 19 // |a_rdn_sequence| and |b_rdn_sequence| should be the DER-encoded RDNSequence
19 // values (not including the Sequence tag). 20 // values (not including the Sequence tag).
20 // Returns true if |a_rdn_sequence| and |b_rdn_sequence| match. 21 // Returns true if |a_rdn_sequence| and |b_rdn_sequence| match.
21 NET_EXPORT bool VerifyNameMatch(const der::Input& a_rdn_sequence, 22 NET_EXPORT bool VerifyNameMatch(const der::Input& a_rdn_sequence,
22 const der::Input& b_rdn_sequence); 23 const der::Input& b_rdn_sequence);
23 24
25 // Compares |name_rdn_sequence| and |parent_rdn_sequence| and return true if
26 // |name_rdn_sequence| is within the subtree defined by |parent_rdn_sequence| as
27 // defined by RFC 5280 section 7.1. |name_rdn_sequence| and
Ryan Sleevi 2015/09/24 22:06:20 single space
mattm 2015/09/30 04:52:32 Done.
28 // |parent_rdn_sequence| should be the DER-encoded sequence values (not
29 // including the Sequence tag).
30 NET_EXPORT bool VerifyNameInSubtree(const der::Input& name_rdn_sequence,
31 const der::Input& parent_rdn_sequence);
32
33 // Helper functions:
34
35 // Sets |*contained_email_address| to true if |name_rdn_sequence| contains an
36 // emailAddress attribute type. Returns false if there was a parsing error.
Ryan Sleevi 2015/09/24 22:06:20 If it doesn't, does it set |*constrained_email_add
mattm 2015/09/30 04:52:32 Reworded. Went with a larger change that reads mor
37 bool NameContainsEmailAddress(const der::Input& name_rdn_sequence,
38 bool* contained_email_address) WARN_UNUSED_RESULT;
39
40 // Extracts and normalizes the commonName attribute from |name_rdn_sequence|
41 // and stores in |*normalized_common_name| as UTF-8.
42 // Returns false if |name_rdn_sequence| did not contain a commonName or there
43 // was a parsing or normalizing error.
Ryan Sleevi 2015/09/24 22:06:20 This makes me even more confused for symmetry with
mattm 2015/09/30 04:52:32 modified to also have an explicit contained_common
44 bool GetNormalizedCommonNameFromName(const der::Input& name_rdn_sequence,
45 std::string* normalized_common_name)
46 WARN_UNUSED_RESULT;
47
24 } // namespace net 48 } // namespace net
25 49
26 #endif // NET_CERT_INTERNAL_VERIFY_NAME_MATCH_H_ 50 #endif // NET_CERT_INTERNAL_VERIFY_NAME_MATCH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698