| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/base64url.h" | 8 #include "base/base64url.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return base64url_encoded; | 42 return base64url_encoded; |
| 43 } | 43 } |
| 44 | 44 |
| 45 scoped_ptr<base::DictionaryValue> CreatePublicKeyJwkDict() { | 45 scoped_ptr<base::DictionaryValue> CreatePublicKeyJwkDict() { |
| 46 scoped_ptr<base::DictionaryValue> jwk(new base::DictionaryValue()); | 46 scoped_ptr<base::DictionaryValue> jwk(new base::DictionaryValue()); |
| 47 jwk->SetString("kty", "RSA"); | 47 jwk->SetString("kty", "RSA"); |
| 48 jwk->SetString("n", | 48 jwk->SetString("n", |
| 49 Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyModulusHex))); | 49 Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyModulusHex))); |
| 50 jwk->SetString("e", | 50 jwk->SetString("e", |
| 51 Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyExponentHex))); | 51 Base64EncodeUrlSafe(HexStringToBytes(kPublicKeyExponentHex))); |
| 52 return jwk.Pass(); | 52 return jwk; |
| 53 } | 53 } |
| 54 | 54 |
| 55 class WebCryptoRsaOaepTest : public WebCryptoTestBase {}; | 55 class WebCryptoRsaOaepTest : public WebCryptoTestBase {}; |
| 56 | 56 |
| 57 // Import a PKCS#8 private key that uses RSAPrivateKey with the | 57 // Import a PKCS#8 private key that uses RSAPrivateKey with the |
| 58 // id-rsaEncryption OID. | 58 // id-rsaEncryption OID. |
| 59 TEST_F(WebCryptoRsaOaepTest, ImportPkcs8WithRsaEncryption) { | 59 TEST_F(WebCryptoRsaOaepTest, ImportPkcs8WithRsaEncryption) { |
| 60 blink::WebCryptoKey private_key; | 60 blink::WebCryptoKey private_key; |
| 61 ASSERT_EQ(Status::Success(), | 61 ASSERT_EQ(Status::Success(), |
| 62 ImportKey(blink::WebCryptoKeyFormatPkcs8, | 62 ImportKey(blink::WebCryptoKeyFormatPkcs8, |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 EXPECT_TRUE(public_key2.extractable()); | 510 EXPECT_TRUE(public_key2.extractable()); |
| 511 EXPECT_EQ(import_algorithm.id(), public_key2.algorithm().id()); | 511 EXPECT_EQ(import_algorithm.id(), public_key2.algorithm().id()); |
| 512 | 512 |
| 513 // TODO(eroman): Export the SPKI and verify matches. | 513 // TODO(eroman): Export the SPKI and verify matches. |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace | 517 } // namespace |
| 518 | 518 |
| 519 } // namespace webcrypto | 519 } // namespace webcrypto |
| OLD | NEW |