I need to create a RSA-SHA1
signature in nodeJS, I am using the following code
const crypto = require("crypto");
const sign = crypto.createSign('RSA-SHA1');
sign.update(data);
const result = sign.sign(privateKey, 'base64')
console.log(result);
I'm double checked that my code result is true, I have same result with online tools if I select sha1WithRSA
algorithm and I also get same result in PHP when I use openssl_sign
function
I need to sign data for a bank API, Unfortunately they don't accept my signature and they have no NodeJS implementation
Also their documentation is a total mess, Here is the C#
implementation of their document
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa.FromXmlString(“<RSAKeyValue><Modulus>oQRshGhLf2Fh...”);
string data = "DATA";
byte[] signMain = rsa.SignData(Encoding.UTF8.GetBytes(data), new
SHA1CryptoServiceProvider());
sign = Convert.ToBase64String(signMain);
Can someone help me to understand why my signature is not equal to the C#
implementation (I don't check result of C# but their server written in C# and they don't verify my signature)
The following links to other official code fragments in PHP that together work with their server, but the result differs from standard openssl_sign
function in PHP: index L211-L216, RSAProcessor L45, rsa.class L17-L22, rsa.class L63-L82.
- Is their implementation a non-standard RSA-SHA1?
- What's wrong with my NodeJS code that their don't accept it?