diff options
Diffstat (limited to 'net/base/x509_util_nss.h')
-rw-r--r-- | net/base/x509_util_nss.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/net/base/x509_util_nss.h b/net/base/x509_util_nss.h new file mode 100644 index 0000000..82dd4f9 --- /dev/null +++ b/net/base/x509_util_nss.h @@ -0,0 +1,37 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_BASE_X509_UTIL_NSS_H_ +#define NET_BASE_X509_UTIL_NSS_H_ +#pragma once + +#include <string> + +#include "base/time.h" + +typedef struct CERTCertificateStr CERTCertificate; +typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; +typedef struct SECKEYPublicKeyStr SECKEYPublicKey; + + +namespace net { + +namespace x509_util { + +// Creates a self-signed certificate containing |public_key|. Subject, serial +// number and validity period are given as parameters. The certificate is +// signed by |private_key|. The hashing algorithm for the signature is SHA-1. +// |subject| is a distinguished name defined in RFC4514. +CERTCertificate* CreateSelfSignedCert( + SECKEYPublicKey* public_key, + SECKEYPrivateKey* private_key, + const std::string& subject, + uint32 serial_number, + base::TimeDelta valid_duration); + +} // namespace x509_util + +} // namespace net + +#endif // NET_BASE_X509_UTIL_NSS_H_ |