Index: content/child/webcrypto/test/ecdsa_unittest.cc |
diff --git a/content/child/webcrypto/test/ecdsa_unittest.cc b/content/child/webcrypto/test/ecdsa_unittest.cc |
index 36e36ff438ed5b56950c3ab96600c68107e093b5..dc7707f9a2267050e04921a99c324246f732d749 100644 |
--- a/content/child/webcrypto/test/ecdsa_unittest.cc |
+++ b/content/child/webcrypto/test/ecdsa_unittest.cc |
@@ -346,9 +346,18 @@ TEST(WebCryptoEcdsaTest, ImportExportPrivateKey) { |
// Test from PKCS8, and then export to {JWK, PKCS8} |
// ------------------------------------------------- |
+ // The imported PKCS8 bytes may differ from the exported bytes (in the case |
+ // where the publicKey was missing, it will be synthesized and written back |
+ // during export). |
+ std::vector<uint8_t> pkcs8_input_bytes; |
+ if (test->HasKey("pkcs8_input")) |
+ pkcs8_input_bytes = GetBytesFromHexString(test, "pkcs8_input"); |
+ CryptoData pkcs8_input_data(pkcs8_input_bytes.empty() ? pkcs8_bytes |
+ : pkcs8_input_bytes); |
+ |
// Import the key using PKCS8 |
ASSERT_EQ(Status::Success(), |
- ImportKey(blink::WebCryptoKeyFormatPkcs8, CryptoData(pkcs8_bytes), |
+ ImportKey(blink::WebCryptoKeyFormatPkcs8, pkcs8_input_data, |
CreateEcdsaImportAlgorithm(curve), true, |
blink::WebCryptoKeyUsageSign, &key)); |