summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorSean Michael Wykes <8363933+SeanWykes@users.noreply.github.com>2022-01-19 03:44:35 -0300
committerGitHub <noreply@github.com>2022-01-19 12:14:35 +0530
commit91399851809b2c1585b318d496e81f9683cd270b (patch)
tree65716b7831d41821e2058c72fec5cba2e80f28b2 /cli
parent77e58fe7f9fc20dabf77424efbd25ce332f8f59c (diff)
feat(ext/crypto): implement pkcs8/JWK for P-384 curves (#13154)
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/webcrypto_test.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/cli/tests/unit/webcrypto_test.ts b/cli/tests/unit/webcrypto_test.ts
index a318e730d..84cf7d4ca 100644
--- a/cli/tests/unit/webcrypto_test.ts
+++ b/cli/tests/unit/webcrypto_test.ts
@@ -1200,10 +1200,7 @@ Deno.test(async function testImportExportEcDsaJwk() {
for (
const [_key, keyData] of Object.entries(jwtECKeys)
) {
- const { size, publicJWK, privateJWK, algo } = keyData;
- if (size != 256) {
- continue;
- }
+ const { publicJWK, privateJWK, algo } = keyData;
// 1. Test import EcDsa
const privateKeyECDSA = await subtle.importKey(
@@ -1268,9 +1265,6 @@ Deno.test(async function testImportEcDhJwk() {
const [_key, jwkData] of Object.entries(jwtECKeys)
) {
const { size, publicJWK, privateJWK } = jwkData;
- if (size != 256) {
- continue;
- }
// 1. Test import EcDsa
const privateKeyECDH = await subtle.importKey(
@@ -1308,6 +1302,11 @@ Deno.test(async function testImportEcDhJwk() {
);
assert(equalJwk(publicJWK, expPublicKeyJWK as JWK));
+ // deriveBits still not implemented for P384
+ if (size != 256) {
+ continue;
+ }
+
const derivedKey = await subtle.deriveBits(
{
name: "ECDH",
@@ -1406,6 +1405,13 @@ Deno.test(async function testImportEcSpkiPkcs8() {
for (
const hash of [/*"SHA-1", */ "SHA-256", "SHA-384" /*"SHA-512"*/]
) {
+ if (
+ (hash == "SHA-256" && namedCurve != "P-256") ||
+ (hash == "SHA-384" && namedCurve != "P-384")
+ ) {
+ continue;
+ }
+
const signatureECDSA = await subtle.sign(
{ name: "ECDSA", hash },
privateKeyECDSA,