Skip to content
This repository has been archived by the owner on Feb 25, 2019. It is now read-only.

RSA-PSS support #56

Closed
thelunararmy opened this issue Nov 30, 2017 · 3 comments
Closed

RSA-PSS support #56

thelunararmy opened this issue Nov 30, 2017 · 3 comments
Labels
Milestone

Comments

@thelunararmy
Copy link
Contributor

thelunararmy commented Nov 30, 2017

Been looking at implementing RSA-PSS using node native, but I cannot see where to inject the salt length as outlined in https://www.w3.org/TR/WebCryptoAPI/#rsa-pss.

Furthermore, it seems that RSA-PSS support is seemingly implemented following this discussion: nodejs/node#1127 and the RSA_PKCS1_PSS_PADDING is available but there is still no direct support of using it with crypto.privateEncrypt or crypto.publicDecrypt outlined here: https://nodejs.org/api/crypto.html#crypto_crypto_privateencrypt_privatekey_buffer.
Finally, the biggest setback is no direct implementation of setting saltLength, they key attribute for PSS, despite nodejs/node@a7d4cad commit explicitly outlining that setting the saltLength is possible.

If anyone can point out an example for me I'd be very appreciative, I'm a bit stuck with this one.

Some external support libraries I've looked at:

@thelunararmy thelunararmy added this to the v1.0.0 milestone Nov 30, 2017
@EternalDeiwos
Copy link
Member

I don't think you can use RSA-PSS to do encryption/decryption -- only signing/verifying. You're meant to use it with something like crypto.createSign('sha-256').

Double checked everything is working here.

@thelunararmy
Copy link
Contributor Author

Right, will check. Thanks @EternalDeiwos

@thelunararmy
Copy link
Contributor Author

Currently a PR for next version.

One quick thing to note regarding testing for sign: These tests will not result in matching signatures since the data is salted by a random generated salt of specified saltLength. Hence the resulting signatures will (or should) always differ Unless these is a way to specify the exact salt there is no way to consistently test this use case except through generating the signature natively, and verifying it in Chrome.
Which is manually tested before each npm release)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants