| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "crypto/ec_private_key.h" | 6 #include "crypto/ec_private_key.h" |
| 7 #include "crypto/openssl_util.h" | 7 #include "crypto/openssl_util.h" |
| 8 #include "net/cert/x509_util.h" | 8 #include "net/cert/x509_util.h" |
| 9 #include "net/cert/x509_util_openssl.h" | 9 #include "net/cert/x509_util_openssl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 TEST(X509UtilOpenSSLTest, CreateDomainBoundCertEC) { | 115 TEST(X509UtilOpenSSLTest, CreateDomainBoundCertEC) { |
| 116 // Create a sample ASCII weborigin. | 116 // Create a sample ASCII weborigin. |
| 117 std::string domain = "weborigin.com"; | 117 std::string domain = "weborigin.com"; |
| 118 base::Time now = base::Time::Now(); | 118 base::Time now = base::Time::Now(); |
| 119 | 119 |
| 120 scoped_ptr<crypto::ECPrivateKey> private_key( | 120 scoped_ptr<crypto::ECPrivateKey> private_key( |
| 121 crypto::ECPrivateKey::Create()); | 121 crypto::ECPrivateKey::Create()); |
| 122 std::string der_cert; | 122 std::string der_cert; |
| 123 ASSERT_TRUE( | 123 ASSERT_TRUE( |
| 124 x509_util::CreateDomainBoundCertEC(private_key.get(), | 124 x509_util::CreateDomainBoundCertEC(private_key.get(), |
| 125 x509_util::DIGEST_SHA1, |
| 125 domain, | 126 domain, |
| 126 1, | 127 1, |
| 127 now, | 128 now, |
| 128 now + base::TimeDelta::FromDays(1), | 129 now + base::TimeDelta::FromDays(1), |
| 129 &der_cert)); | 130 &der_cert)); |
| 130 | 131 |
| 131 VerifyDomainBoundCert(domain, der_cert); | 132 VerifyDomainBoundCert(domain, der_cert); |
| 132 | 133 |
| 133 // signature_verifier_win and signature_verifier_mac can't handle EC certs. | 134 // signature_verifier_win and signature_verifier_mac can't handle EC certs. |
| 134 std::vector<uint8> spki; | 135 std::vector<uint8> spki; |
| 135 ASSERT_TRUE(private_key->ExportPublicKey(&spki)); | 136 ASSERT_TRUE(private_key->ExportPublicKey(&spki)); |
| 136 VerifyCertificateSignature(der_cert, spki); | 137 VerifyCertificateSignature(der_cert, spki); |
| 137 } | 138 } |
| 138 | 139 |
| 139 } // namespace net | 140 } // namespace net |
| OLD | NEW |