Bug 1920705 - Allow exporting raw X25519 public keys r=keeler,jfernandez

Differential Revision: https://phabricator.services.mozilla.com/D223326
This commit is contained in:
Anna Weine 2024-09-25 13:21:25 +00:00
parent 76b5ab4f02
commit 6512f518f8
3 changed files with 7 additions and 99 deletions

View File

@ -1056,9 +1056,10 @@ KeyType KeyTypeFromCurveName(const nsAString& aNamedCurve) {
aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_P384) ||
aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_P521)) {
t = ecKey;
} else if (aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_ED25519) ||
aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_CURVE25519)) {
} else if (aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_ED25519)) {
t = edKey;
} else if (aNamedCurve.EqualsLiteral(WEBCRYPTO_NAMED_CURVE_CURVE25519)) {
t = ecMontKey;
}
return t;
}
@ -1087,7 +1088,8 @@ UniqueSECKEYPublicKey CreateECPublicKey(const SECItem* aKeyData,
// Transfer arena ownership to the key.
key->arena = arena.release();
key->keyType = KeyTypeFromCurveName(aNamedCurve);
if (key->keyType != ecKey && key->keyType != edKey) {
if (key->keyType != ecKey && key->keyType != edKey &&
key->keyType != ecMontKey) {
return nullptr;
}

View File

@ -2262,7 +2262,8 @@ class ExportKeyTask : public WebCryptoTask {
}
if (mPublicKey &&
(mPublicKey->keyType == ecKey || mPublicKey->keyType == edKey)) {
(mPublicKey->keyType == ecKey || mPublicKey->keyType == edKey ||
mPublicKey->keyType == ecMontKey)) {
nsresult rv = CryptoKey::PublicECKeyToRaw(mPublicKey.get(), mResult);
if (NS_FAILED(rv)) {
return NS_ERROR_DOM_OPERATION_ERR;

View File

@ -1,102 +1,7 @@
[successes_X25519.https.any.worker.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Success: generateKey({name: X25519}, false, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[successes_X25519.https.any.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[Success: generateKey({name: X25519}, false, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: X25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveBits, deriveKey\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL
[Success: generateKey({name: x25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits\])]
expected: FAIL