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

91
Visualizações
Issue with crypto.importKey in Safari

i'm developing a webpage, which also must have a chat-feature, so that user can communicate with each other over the platform. The messages should be encrypted with end-to-end encryption. Therefore i use the built-in crypto library of the Web-API. At the end of the registration process, each user gets a keypair generated. When a user is logged in, his private key (in jwk-format) will be loaded with:
crypto.subtle.importKey("jwk", data, { name: 'ECDH', namedCurve : 'P-256' }, true, ["deriveKey", "deriveBits"]).then(...).
When the user attempting to start a conversation with an another user, the public key of the other user will loaded with:
crypto.subtle.importKey("jwk", jwkData, { name: 'ECDH', namedCurve : 'P-256' }, true, ["deriveKey", "deriveBits"]).then(...) or
crypto.subtle.importKey("spki", base64data, { name: 'ECDH', namedCurve : 'P-256' }, true, ["deriveKey", "deriveBits"]).then(...).

The whole en-/decryption process works perfectly on Firefox. But if i try the same code with Safari, the loading of the public key fails with: SyntaxError: A required parameter was missing or out-of-range.. I get this same error if i try to load the key from base64 or jwk data. I managed to find out which parameter is missing, it is the "d"-component in the jwk, but this should be only included in the private key, shouldn't it? The private key can be loaded as expected also in Safari, only the public key not.

I browsed the Safari-buglist with crypto, there are a bunch of them, but not specially this one. Has anyone experience with this error or any idea, how to fix it?

Thanks and best regards, Attila

about 4 years ago · Juan Pablo Isaza
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