haikuwebkit/LayoutTests/crypto/subtle/ecdsa-import-key-verify-p52...

45 lines
1.4 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 verifying operation with a P-521 public key");
jsTestIsAsync = true;
var extractable = true;
var jwkPublicKey = {
kty: "EC",
crv: "P-521",
x: "ATyYJNg6KbLelgL09FGKksW7qfIEPf4OPCHB7PuoUq4AyiJQaMqWD7TagGc4gwY5lJ7rDRLKGdxGmf19inAT_X1a",
y: "AAF1xys7jFj4QkHBC3uF_Kodak7rOkbmpAPKrqzR_akXaCwNfdsjX12_uVkDhyUqF-C5oUYsKLqET8RMm8kg8cX9",
};
var ecdsaParams = {
name: "ECDSA",
hash: "SHA-256",
}
var data = asciiToUint8Array("Hello, World!");
var signature = hexStringToUint8Array("013f4994b96ea2d6ce58e70bde70717f00891194c91acb9ad6e6897b7769d837d3ed2695dd3de6f5e06413310a4e8b0aad83873ca7359584958a2d1ec1dad86a841c008961578f7cc2fb15703f614854921b7b5fff7ee38cacd37744419213582328903cb7c44d9c08378c5e1e70edabac439d3490680e9e1225f7c377bd44311717bdaa");
crypto.subtle.importKey("jwk", jwkPublicKey, { name: "ECDSA", namedCurve: "P-521" }, extractable, ["verify"]).then(function(key) {
return crypto.subtle.verify(ecdsaParams, key, signature, data);
}).then(function(result) {
verified = result;
shouldBeTrue("verified");
finishJSTest();
}, failAndFinishJSTest);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>