Axone
Axone
DDeno
Created by Axone on 8/5/2023 in #help
Bad implementation of X25519?
I can't generate a shared secret with the current implementation of X25519
const alice = await crypto.subtle.generateKey({ name: "X25519" }, true, [
"deriveKey",
"deriveBits",
]) as CryptoKeyPair;

const bob = await crypto.subtle.generateKey({ name: "X25519" }, true, [
"deriveKey",
"deriveBits",
]) as CryptoKeyPair;

const secret = await crypto.subtle.deriveBits(
{ name: "X25519", public: alice.publicKey },
bob.privateKey,
256,
);

console.log(secret);
const alice = await crypto.subtle.generateKey({ name: "X25519" }, true, [
"deriveKey",
"deriveBits",
]) as CryptoKeyPair;

const bob = await crypto.subtle.generateKey({ name: "X25519" }, true, [
"deriveKey",
"deriveBits",
]) as CryptoKeyPair;

const secret = await crypto.subtle.deriveBits(
{ name: "X25519", public: alice.publicKey },
bob.privateKey,
256,
);

console.log(secret);
7 replies