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 f974622d62822af19fc7b552b4b4cad5720dff42..9579410094be9132c84860143a5222fe8cf83c97 100644 |
--- a/content/child/webcrypto/test/ecdsa_unittest.cc |
+++ b/content/child/webcrypto/test/ecdsa_unittest.cc |
@@ -345,9 +345,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)); |