Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda