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

Unified Diff: content/child/webcrypto/shared_crypto_unittest.cc

Issue 203753009: [webcrypto] Add PKCS#8 export for RSA private keys for NSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove static Created 6 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: content/child/webcrypto/shared_crypto_unittest.cc
diff --git a/content/child/webcrypto/shared_crypto_unittest.cc b/content/child/webcrypto/shared_crypto_unittest.cc
index 55c3bb7a57a75a35305d7f46148e27ed28001044..abcb27162ba1aad9206e157dbc82461ca5879528 100644
--- a/content/child/webcrypto/shared_crypto_unittest.cc
+++ b/content/child/webcrypto/shared_crypto_unittest.cc
@@ -808,7 +808,7 @@ TEST_F(SharedCryptoTest, AesCbcFailures) {
// keys).
EXPECT_STATUS(Status::ErrorUnexpectedKeyType(),
ExportKey(blink::WebCryptoKeyFormatSpki, key, &output));
- EXPECT_STATUS(Status::ErrorUnsupported(),
+ EXPECT_STATUS(Status::ErrorUnexpectedKeyType(),
ExportKey(blink::WebCryptoKeyFormatPkcs8, key, &output));
}
@@ -1712,7 +1712,7 @@ TEST_F(SharedCryptoTest, MAYBE(ImportExportSpki)) {
ExportKey(blink::WebCryptoKeyFormatSpki, key, &output));
}
-TEST_F(SharedCryptoTest, MAYBE(ImportPkcs8)) {
+TEST_F(SharedCryptoTest, MAYBE(ImportExportPkcs8)) {
// Passing case: Import a valid RSA key in PKCS#8 format.
blink::WebCryptoKey key = blink::WebCryptoKey::createNull();
ASSERT_STATUS_SUCCESS(ImportKey(
@@ -1735,6 +1735,11 @@ TEST_F(SharedCryptoTest, MAYBE(ImportPkcs8)) {
"010001",
CryptoData(key.algorithm().rsaHashedParams()->publicExponent()));
+ blink::WebArrayBuffer exported_key;
+ ASSERT_STATUS_SUCCESS(
+ ExportKey(blink::WebCryptoKeyFormatPkcs8, key, &exported_key));
+ ExpectArrayBufferMatchesHex(kPrivateKeyPkcs8DerHex, exported_key);
+
// Failing case: Empty PKCS#8 data
EXPECT_STATUS(Status::ErrorImportEmptyKeyData(),
ImportKey(blink::WebCryptoKeyFormatPkcs8,
« content/child/webcrypto/platform_crypto_nss.cc ('K') | « content/child/webcrypto/shared_crypto.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698