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