diff options
Diffstat (limited to 'cli/tests/unit/webcrypto_test.ts')
-rw-r--r-- | cli/tests/unit/webcrypto_test.ts | 20 |
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, |