Re: webcrypto examples that show how to interact with other backend

nodejs always uses sha1 in the MGF step but the web crypto api uses
whatever algorythem you supply in your case sha-256

On Wed, Nov 18, 2015 at 8:22 AM Jeroen van Veen <
jeroen.van.veen@wearespindle.com> wrote:

> Hello,
>
> I'm trying to add AES key exchange using RSA encryption. So far I could
> only
> find examples that show how to do this in the browser, but none of them
> explain how to exchange keys and decrypt ciphertext properly when used
> together with a backend platform(like nodejs). Therefor I made a very
> minimal
> webapplication that tries to exchange JWK keys and decrypt some ciphertext
> that comes either from webcrypto or from Nodejs ursa. So far I came up with
> https://github.com/jvanveen/crypto-nodebrowser/
>
> Something is still not right. I managed to pass around jwk keys and checked
> whether they still are the same. This seems to be the case. But when I try
> to
> decrypt a ciphertext with a private key in ursa, that was encrypted with
> webcrypto (using the imported public key from ursa), I get an OAEP padding
> error like:
>
> Error: error:040A1079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep
> decoding error
>     at Error (native)
>     at Object.decrypt (/home/projects/crypto-nodebrowser/node_modules/ursa/
> lib/ursa.js:358:33)
>     at Socket.<anonymous>
> (/home/projects/crypto-nodebrowser/server.js:150:41)
>     at emitOne (events.js:77:13)
>     at Socket.emit (events.js:169:7)
>     at Socket.onevent (/home/projects/crypto-nodebrowser/node_modules/
> socket.io/lib/socket.js:330:8)
>     at Socket.onpacket (/home/projects/crypto-nodebrowser/node_modules/
> socket.io/lib/socket.js:290:12)
>     at Client.ondecoded (/home/projects/crypto-nodebrowser/node_modules/
> socket.io/lib/client.js:193:14)
>     at Decoder.Emitter.emit
> (/home/projects/crypto-nodebrowser/node_modules/
> component-emitter/index.js:134:20)
>     at Decoder.add
> (/home/projects/crypto-nodebrowser/node_modules/socket.io-
> parser/index.js:247:12)
>
> Any help getting this example up and running would be great. It's probably
> something small that I missed.
>
> kind regards,
>
> Jeroen van Veen
>
>
>
>

Received on Wednesday, 18 November 2015 16:30:38 UTC