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

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

Issue 8566056: This applies GUIDs to certificate and key nicknames when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review changes Created 9 years 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 | Annotate | Revision Log
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_BASE_X509_UTIL_NSS_H_ 5 #ifndef NET_BASE_X509_UTIL_NSS_H_
6 #define NET_BASE_X509_UTIL_NSS_H_ 6 #define NET_BASE_X509_UTIL_NSS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "net/base/cert_type.h"
12 13
13 typedef struct CERTCertificateStr CERTCertificate; 14 typedef struct CERTCertificateStr CERTCertificate;
14 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; 15 typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey;
15 typedef struct SECKEYPublicKeyStr SECKEYPublicKey; 16 typedef struct SECKEYPublicKeyStr SECKEYPublicKey;
16 17
17 18
18 namespace net { 19 namespace net {
19 20
21 class X509Certificate;
22
20 namespace x509_util { 23 namespace x509_util {
21 24
22 // Creates a self-signed certificate containing |public_key|. Subject, serial 25 // Creates a self-signed certificate containing |public_key|. Subject, serial
23 // number and validity period are given as parameters. The certificate is 26 // number and validity period are given as parameters. The certificate is
24 // signed by |private_key|. The hashing algorithm for the signature is SHA-1. 27 // signed by |private_key|. The hashing algorithm for the signature is SHA-1.
25 // |subject| is a distinguished name defined in RFC4514. 28 // |subject| is a distinguished name defined in RFC4514.
26 CERTCertificate* CreateSelfSignedCert( 29 CERTCertificate* CreateSelfSignedCert(
27 SECKEYPublicKey* public_key, 30 SECKEYPublicKey* public_key,
28 SECKEYPrivateKey* private_key, 31 SECKEYPrivateKey* private_key,
29 const std::string& subject, 32 const std::string& subject,
30 uint32 serial_number, 33 uint32 serial_number,
31 base::TimeDelta valid_duration); 34 base::TimeDelta valid_duration);
32 35
36 // Returns a default label for the cert based on its type. On ChromeOS, this
37 // will return the certificate's label if set, and generate a new label if not.
38 std::string GetDefaultCertificateLabel(const X509Certificate* cert);
39
40 // Gets which type of certificate this is, based on the certificate's
wtc 2011/12/08 00:07:43 Nit: Gets => Returns
41 // properties.
42 CertType GetCertType(const X509Certificate* cert);
43
44 // These are only defined on ChromeOS because it is the only platform where
45 // we have a patched NSS that will set labels on certificates.
46 #if defined(OS_CHROMEOS)
47 // Set/get the label of this certificate. This corresponds to the CKA_LABEL
wtc 2011/12/08 00:07:43 Nit: Set/get => Sets/gets
48 // attribute of the certificate. Setting the label on the certificate also
wtc 2011/12/08 00:07:43 Nit: add "PKCS #11" before "attribute".
49 // sets the same CKA_LABEL on the associated public and private keys for the
50 // certificate.
51 bool SetLabel(X509Certificate* cert, const std::string& label);
52 std::string GetLabel(const X509Certificate* cert);
wtc 2011/12/08 00:07:43 These two functions should be named SetCertifica
53 #endif // OS_CHROMEOS
33 } // namespace x509_util 54 } // namespace x509_util
wtc 2011/12/08 00:07:43 Nit: add a blank line before this line.
34 55
35 } // namespace net 56 } // namespace net
36 57
37 #endif // NET_BASE_X509_UTIL_NSS_H_ 58 #endif // NET_BASE_X509_UTIL_NSS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698