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

Side by Side Diff: net/base/x509_certificate_nss_util.h

Issue 10928107: Support x509 certificate on iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added unittests and fixed compilation issues. Created 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_
6 #define NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_
7
8 #include <cert.h>
9 #include <string>
10 #include <vector>
11
12 #include "net/base/x509_certificate.h"
13
14 namespace base {
15 class Time;
16 }
17
18 class PickleIterator;
19
20 namespace net {
21 namespace x509_certificate_nss_util {
22
23 // Parses the Principal attribute from |name| and outputs the result in
24 // |principal|.
25 void ParsePrincipal(CERTName* name,
26 CertPrincipal* principal);
27
28 // Parses the date from |der_date| and outputs the result in |result|.
29 void ParseDate(const SECItem* der_date, base::Time* result);
30
31 // Parses the serial number from |certificate|.
32 std::string ParseSerialNumber(const CERTCertificate* certificate);
33
34 // Gets the subjectAltName extension field from the certificate, if any.
35 void GetSubjectAltName(CERTCertificate* cert_handle,
36 std::vector<std::string>* dns_names,
37 std::vector<std::string>* ip_addrs);
38
39 // Creates all possible OS certificate handles from |data| encoded in a specific
40 // |format|. Returns an empty collection on failure.
41 X509Certificate::OSCertHandles CreateOSCertHandlesFromBytes(
42 const char* data,
43 int length,
44 X509Certificate::Format format);
45
46 // Reads a single certificate from |pickle_iter| and returns a platform-specific
47 // certificate handle. Returns an invalid handle, NULL, on failure.
48 X509Certificate::OSCertHandle ReadOSCertHandleFromPickle(
49 PickleIterator* pickle_iter);
50
51 // Sets |*size_bits| to be the length of the public key in bits, and sets
52 // |*type| to one of the |PublicKeyType| values. In case of
53 // |kPublicKeyTypeUnknown|, |*size_bits| will be set to 0.
54 void GetPublicKeyInfo(CERTCertificate* handle,
55 size_t* size_bits,
56 X509Certificate::PublicKeyType* type);
57
58 } // namespace x509_certificate_nss_util
59 } // namespace net
60
61 #endif // NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698