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

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

Issue 1720653002: Add new functions to handle UPN and email addresses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ios build breakage Created 4 years, 9 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/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util_nss_certs.cc » ('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) 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_CERT_X509_UTIL_NSS_H_ 5 #ifndef NET_CERT_X509_UTIL_NSS_H_
6 #define NET_CERT_X509_UTIL_NSS_H_ 6 #define NET_CERT_X509_UTIL_NSS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 // |principal|. 33 // |principal|.
34 void ParsePrincipal(CERTName* name, 34 void ParsePrincipal(CERTName* name,
35 CertPrincipal* principal); 35 CertPrincipal* principal);
36 36
37 // Parses the date from |der_date| and outputs the result in |result|. 37 // Parses the date from |der_date| and outputs the result in |result|.
38 void ParseDate(const SECItem* der_date, base::Time* result); 38 void ParseDate(const SECItem* der_date, base::Time* result);
39 39
40 // Parses the serial number from |certificate|. 40 // Parses the serial number from |certificate|.
41 std::string ParseSerialNumber(const CERTCertificate* certificate); 41 std::string ParseSerialNumber(const CERTCertificate* certificate);
42 42
43 // Gets the subjectAltName extension field from the certificate, if any. 43 // Gets the dNSName and iPAddress name types from the subjectAltName
44 // extension of |cert_handle|, storing them in |dns_names| and
45 // |ip_addrs|, respectively.
46 // If no subjectAltName is present, or no names of that type are
47 // present, the relevant vectors are cleared.
44 void GetSubjectAltName(CERTCertificate* cert_handle, 48 void GetSubjectAltName(CERTCertificate* cert_handle,
45 std::vector<std::string>* dns_names, 49 std::vector<std::string>* dns_names,
46 std::vector<std::string>* ip_addrs); 50 std::vector<std::string>* ip_addrs);
47 51
52 // Stores the values of all rfc822Name subjectAltNames from |cert_handle|
53 // into |names|. If no names are present, clears |names|.
54 // WARNING: This method does not validate that the rfc822Name is
55 // properly encoded; it MAY contain embedded NULs or other illegal
56 // characters; care should be taken to validate the well-formedness
57 // before using.
58 NET_EXPORT void GetRFC822SubjectAltNames(CERTCertificate* cert_handle,
59 std::vector<std::string>* names);
60
61 // Stores the values of all Microsoft UPN subjectAltNames from |cert_handle|
62 // into |names|. If no names are present, clears |names|.
63 //
64 // A "Microsoft UPN subjectAltName" is an OtherName value whose type-id
65 // is equal to 1.3.6.1.4.1.311.20.2.3 (known as either id-ms-san-sc-logon-upn,
66 // as described in RFC 4556, or as szOID_NT_PRINCIPAL_NAME, as
67 // documented in Microsoft KB287547).
68 // The value field is a UTF8String literal.
69 // For more information:
70 // https://www.ietf.org/mail-archive/web/pkix/current/msg03145.html
71 // https://www.ietf.org/proceedings/65/slides/pkix-4/sld1.htm
72 // https://tools.ietf.org/html/rfc4556
73 //
74 // WARNING: This method does not validate that the name is
75 // properly encoded; it MAY contain embedded NULs or other illegal
76 // characters; care should be taken to validate the well-formedness
77 // before using.
78 NET_EXPORT void GetUPNSubjectAltNames(CERTCertificate* cert_handle,
79 std::vector<std::string>* names);
80
48 // Creates all possible OS certificate handles from |data| encoded in a specific 81 // Creates all possible OS certificate handles from |data| encoded in a specific
49 // |format|. Returns an empty collection on failure. 82 // |format|. Returns an empty collection on failure.
50 X509Certificate::OSCertHandles CreateOSCertHandlesFromBytes( 83 X509Certificate::OSCertHandles CreateOSCertHandlesFromBytes(
51 const char* data, 84 const char* data,
52 size_t length, 85 size_t length,
53 X509Certificate::Format format); 86 X509Certificate::Format format);
54 87
55 // Reads a single certificate from |pickle_iter| and returns a platform-specific 88 // Reads a single certificate from |pickle_iter| and returns a platform-specific
56 // certificate handle. Returns an invalid handle, NULL, on failure. 89 // certificate handle. Returns an invalid handle, NULL, on failure.
57 X509Certificate::OSCertHandle ReadOSCertHandleFromPickle( 90 X509Certificate::OSCertHandle ReadOSCertHandleFromPickle(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 std::string GetUniqueNicknameForSlot(const std::string& nickname, 127 std::string GetUniqueNicknameForSlot(const std::string& nickname,
95 const SECItem* subject, 128 const SECItem* subject,
96 PK11SlotInfo* slot); 129 PK11SlotInfo* slot);
97 #endif // defined(USE_NSS_CERTS) || defined(OS_IOS) 130 #endif // defined(USE_NSS_CERTS) || defined(OS_IOS)
98 131
99 } // namespace x509_util 132 } // namespace x509_util
100 133
101 } // namespace net 134 } // namespace net
102 135
103 #endif // NET_CERT_X509_UTIL_NSS_H_ 136 #endif // NET_CERT_X509_UTIL_NSS_H_
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/cert/x509_util_nss_certs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698