diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 01:47:04 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 01:47:04 +0000 |
commit | 3c5f6db2ef15a4ac179351764f320e16364fa457 (patch) | |
tree | c69a4d6684d81d73a622343311c2e962501819e4 /net/base/x509_util_openssl_unittest.cc | |
parent | 091a5b6f0dede5cedee54ec1aae623a946ab405f (diff) | |
download | chromium_src-3c5f6db2ef15a4ac179351764f320e16364fa457.zip chromium_src-3c5f6db2ef15a4ac179351764f320e16364fa457.tar.gz chromium_src-3c5f6db2ef15a4ac179351764f320e16364fa457.tar.bz2 |
Use NSS to generate Origin-Bound Certs on Win and Mac.
The platform RSAPrivateKey is used to generate the private key, which is then imported into NSS to generate the certificate.
X509Certificate::CreateOriginBound is moved to x509_util::CreateOriginBoundCert so it can be shared by those platforms, and removes the unnecessary X509Certificate generation step.
BUG=88782
TEST=X509UtilNSSTest.CreateOriginBoundCert & manual testing: try on win or mac, check if generated cert has the OBC extension.
Review URL: http://codereview.chromium.org/8296014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/x509_util_openssl_unittest.cc')
-rw-r--r-- | net/base/x509_util_openssl_unittest.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/base/x509_util_openssl_unittest.cc b/net/base/x509_util_openssl_unittest.cc new file mode 100644 index 0000000..0647a62 --- /dev/null +++ b/net/base/x509_util_openssl_unittest.cc @@ -0,0 +1,29 @@ +// 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. + +#include "base/memory/scoped_ptr.h" +#include "crypto/rsa_private_key.h" +#include "net/base/x509_util.h" +#include "net/base/x509_util_openssl.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace net { + +// For OpenSSL, x509_util::CreateOriginBoundCert() is not yet implemented +// and should return false. This unit test ensures that a stub implementation +// is present. +TEST(X509UtilOpenSSLTest, CreateOriginBoundCertNotImplemented) { + std::string origin = "http://weborigin.com:443"; + scoped_ptr<crypto::RSAPrivateKey> private_key( + crypto::RSAPrivateKey::Create(1024)); + std::string der_cert; + EXPECT_FALSE(x509_util::CreateOriginBoundCert(private_key.get(), + origin, 1, + base::TimeDelta::FromDays(1), + &der_cert)); + EXPECT_TRUE(der_cert.empty()); + +} + +} // namespace net |