After some research it would seem that RSA with PSS padding is suggested to be used as its security properties are known to be good. The problem is that it is hard to have compatibility of signing algorithms, especially with such requirements.
What I'd like to achieve is to sign and verify across at least the following environments:
- Botan
- OpenSSL
- Crypto++
- Node.js (uses OpenSSL)
It might also be interesting to have compatibility on PolarSSL and others.
There is an example in the node.js
crypto page about creating and verifying signatures. This works nicely, but I need compatibility with Botan EMSAx(SHA256), and really think that a signature should be padded for security with something like RSA-PSS. The Node example page only show 'RSA-SHA256'
but there is no padding used.
The PSS padding can be achieved by using OpenSSL:
openssl dgst -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:32 \
-sign rsa.key -out data.txt.sha256 data.txt
My test code looks something like this:
var s = crypto.createSign('RSA-SHA256');
var key = fs.readFileSync('rsa.key').toString();
s.update(message);
var signature = s.sign(key, 'base64');
but it produces identical output for identical input, which is not what I want, and is obviously not compatible with the C++ implementation I have which uses Botan.
If it is not possible to achieve compatibility with minimal effort, any suggestions on which algorithms to pick, I might put the effort in to try to contact the developers of these crypto-libraries, to see if there is any consensus on an algorithm to get implemented as a de facto standard. (Yes, I know this seems desperate.) Is there an ongoing effort like this?