haikuwebkit/LayoutTests/crypto/subtle/ecdsa-import-key-sign-p521....

45 lines
1.2 KiB
HTML
Raw Permalink Normal View History

[WebCrypto] Add layout tests covering EC P-521 https://bugs.webkit.org/show_bug.cgi?id=175659 Reviewed by Jiewen Tan. Add layout tests that cover operations with 521-bit elliptic curves. The newly-introduced tests are skipped on all platforms for now since no implementation provides support just yet. The already-existing tests are modified in a way that only tests the EC P-521 capability optionally, if e.g. P-521 key imports are successful, without affecting the tests for P-256 and P-384 operations. The newly-introduced tests are mirros of existing P-256 and P-384 tests, but they specifically test the P-521 capabilities and use appropriate curve information (X and Y coordinates for the EC public key, D for the EC private key) for that type of elliptic curve. * crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p521-expected.txt: Added. * crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p521.html: Added. * crypto/subtle/ec-import-spki-key-export-spki-key-p521-expected.txt: Added. * crypto/subtle/ec-import-spki-key-export-spki-key-p521.html: Added. * crypto/subtle/ecdh-derive-bits-length-limits-expected.txt: * crypto/subtle/ecdh-derive-bits-length-limits.html: * crypto/subtle/ecdh-generate-export-jwk-key-p521-expected.txt: Added. * crypto/subtle/ecdh-generate-export-jwk-key-p521.html: Added. * crypto/subtle/ecdh-generate-export-key-pkcs8-p521-expected.txt: Added. * crypto/subtle/ecdh-generate-export-key-pkcs8-p521.html: Added. * crypto/subtle/ecdh-generate-export-key-raw-p521-expected.txt: Added. * crypto/subtle/ecdh-generate-export-key-raw-p521.html: Added. * crypto/subtle/ecdh-generate-export-key-spki-p521-expected.txt: Added. * crypto/subtle/ecdh-generate-export-key-spki-p521.html: Added. * crypto/subtle/ecdh-generate-key-p521-expected.txt: Added. * crypto/subtle/ecdh-generate-key-p521.html: Added. * crypto/subtle/ecdh-import-jwk-private-key-p521-expected.txt: Added. * crypto/subtle/ecdh-import-jwk-private-key-p521.html: Added. * crypto/subtle/ecdh-import-jwk-public-key-p521-expected.txt: Added. * crypto/subtle/ecdh-import-jwk-public-key-p521.html: Added. * crypto/subtle/ecdh-import-pkcs8-key-p521-expected.txt: Added. * crypto/subtle/ecdh-import-pkcs8-key-p521-validate-ecprivatekey-parameters-publickey-expected.txt: Added. * crypto/subtle/ecdh-import-pkcs8-key-p521-validate-ecprivatekey-parameters-publickey.html: Added. * crypto/subtle/ecdh-import-pkcs8-key-p521.html: Added. * crypto/subtle/ecdh-import-raw-key-p521-expected.txt: Added. * crypto/subtle/ecdh-import-raw-key-p521.html: Added. * crypto/subtle/ecdh-import-spki-key-ecdh-identifier-expected.txt: * crypto/subtle/ecdh-import-spki-key-ecdh-identifier.html: * crypto/subtle/ecdh-import-spki-key-p521-expected.txt: Added. * crypto/subtle/ecdh-import-spki-key-p521.html: Added. * crypto/subtle/ecdsa-generate-key-sign-verify-p521-expected.txt: Added. * crypto/subtle/ecdsa-generate-key-sign-verify-p521.html: Added. * crypto/subtle/ecdsa-import-jwk-public-key-alg-521-expected.txt: Added. * crypto/subtle/ecdsa-import-jwk-public-key-alg-521.html: Added. * crypto/subtle/ecdsa-import-key-sign-p521-expected.txt: Added. * crypto/subtle/ecdsa-import-key-sign-p521.html: Added. * crypto/subtle/ecdsa-import-key-verify-p521-expected.txt: Added. * crypto/subtle/ecdsa-import-key-verify-p521.html: Added. * crypto/subtle/ecdsa-import-pkcs8-key-p521-validate-ecprivatekey-parameters-publickey-expected.txt: Added. * crypto/subtle/ecdsa-import-pkcs8-key-p521-validate-ecprivatekey-parameters-publickey.html: Added. * platform/gtk/TestExpectations: * platform/ios/TestExpectations: * platform/mac/TestExpectations: * platform/wpe/TestExpectations: Canonical link: https://commits.webkit.org/192772@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-30 07:31:32 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
description("Test ECDSA signing operation with a P-521 private key");
jsTestIsAsync = true;
var extractable = true;
var jwkPrivateKey = {
kty: "EC",
crv: "P-521",
x: "ATyYJNg6KbLelgL09FGKksW7qfIEPf4OPCHB7PuoUq4AyiJQaMqWD7TagGc4gwY5lJ7rDRLKGdxGmf19inAT_X1a",
y: "AAF1xys7jFj4QkHBC3uF_Kodak7rOkbmpAPKrqzR_akXaCwNfdsjX12_uVkDhyUqF-C5oUYsKLqET8RMm8kg8cX9",
d: "APLcP3zg0beau_cHUhnqmoeduWOKTh3Ki7shV0NxvrXTIp4pCUv3RX6do19RD7c4Goh3EGO3UJ9FdhzbeNLzYmmH",
};
var ecdsaParams = {
name: "ECDSA",
hash: "SHA-256",
}
var data = asciiToUint8Array("Hello, World!");
crypto.subtle.importKey("jwk", jwkPrivateKey, { name: "ECDSA", namedCurve: "P-521" }, extractable, ["sign"]).then(function(key) {
return crypto.subtle.sign(ecdsaParams, key, data);
}).then(function(result) {
signature = result;
shouldBe("signature.byteLength", "132");
finishJSTest();
}, failAndFinishJSTest);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>