Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

206
Visualizações
Is there a way for generation of ecdh shared key in 'node-forge' or other checked and secure js oackage

Well what i want to obtain is something like this

import * as forge from 'node-forge'
const aliceKey = forge.pki.ed25519.generateKeyPair();
const bobKey = forge.pki.ed25519.generateKeyPair();

//get shared secret for bob and alice
function getSharedKey(publicKey, privateKey){
//some code
}

const sharedKeyFromAlicePerspective = getSharedKey(bobKey.publicKey , aliceKey.privateKey);
const sharedKeyFromBobPerspective = getSharedKey(aliceKey.publicKey, bobKey.privateKey);

console.log(sharedKeyFromAlicePerspective === sharedKeyFromBobPerspective)//expect 'true'

Also i am open for changing library for other secure and well maintained and tested if its not possible in standard that this library provides (my point is to make smallest possible secure public keys for encryption beetween parties)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

well beside @Topaco answear i found out if you are in browser that support Crypto.subtle api you can do without modules.

const aliceKey = await window.crypto.subtle.generateKey({name: 'ECDH', namedCurve: 'P-521'},false, ['deriveBits']);
const bobKey = await window.crypto.subtle.generateKey({name: 'ECDH', namedCurve: 'P-521'},false, ['deriveBits']);
const secret = await window.crypto.subtle.deriveBits({
        name: "ECDH",
        namedCurve: "P-521",
        public: bobKey.publicKey
    },
    aliceKey.privateKey, 
    521
)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda