Closed obie3 closed 2 years ago
Hi @obie3 thanks for report the issue could you share an example with a sample privateKey and a NodeRSA encrypted data, so I can create some tests around
@jerson thanks for your reply, here is a sample privateKey and encrypted string from our server
privateKey = -----BEGIN RSA PRIVATE KEY----- MIIG5AIBAAKCAYEAj00SiHKSn1F1VwF11Fwen2DEIKJJS4fG62GQSjR/WG+QUucB HVAjTZSr5502qWhy3J0m082EbEsqHOaikJy4XewyX9JwSUm71XC3dcsObK/Nk+N8 4dloCXOAdwtTsKvXheD79W2+IHM/AFpnbrp3aUzZ9hQ1mmkXa46lzr8lSN3XqIUb PvX7DleW2S9I9uXySaKlMpbcxPlHy4F7Le/cyLqL3lhlmjyllf/clkxzVk/6yls8 CqfytjEfaKc7KKGEzm0MiErZUSfgUKIy9Urh5/ZPHi3vQ3UWwsnrOsT92pi6fRjY 4OXKhG/THhpuq837nsZNJ0Kye2xwkvP+UsLctWxtTR+83LKHQk8v9oLx3Y/DA5ol kA0ojHUZDVpFHg6ACsi6S2DAtQmEWEDK1ZUZqpTIa5+F5dDjwUBzMadNPdfBUR51 wAz/lVwWo2zR+zhp56FmyccKyS/5ZM19hDBxcZiwBkegTpvu2Vz8OXeDaxTH6xnd wiogKpcgZWUZhYn/AgMBAAECggGARZpR3iSIQwn1zITRDoyP8ym1GYS5xQ31+G4y /1fwYqwNlbbOO8ao3w3PUXhzDGXHJJDQQyAXqeH4WoFLhKIaisQm05QLJg3CRjGx am1uXCwn1iUwiyJl/fEz/J5rz+wnisd0mgjryCcx+qHui0HWrja9x2CZiJ5y2bM3 pewB2BqonRnJ2hLwFk9E3cixz/pwbIOraZ8NLD9IN/h0NCPFQVoahay57Oh4JRtZ sUcA3nOKhK87wpFAum2xq8tOWLXaaVFoNYW6dVVP/cw/x9grKbvK0F4KflwcQUYR v8Pa5hxRZTEVNSbr1y3rQDSULx8/3seFf3NahrTQmKc6ML7mtQiKA1QEDsM5uO22 Z03sfMXSI+g2yHKTxw/wpRjNB736MJ05t/UmHdas+DMGgr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W1ZPraNHKT4O wHH+ZfHcKSy34HCT80Ci2Kn+dubldy8jOo+J2nzoxUHtYifxAoHBAK0Y4B64Ezee 5DKxglDjDWAyO70c7kaDIzPg/YJe0X9i7Z7LaUiM4Xe1NGFa9l+pJT4YIMzVyQZk 9r5KCq5aB9m7gwrEkSbUq0P6PXKIDZWqzoL7cwfdyVhOOX4WTIkHj3L9KkhdKoWZ b0CeL58IIKE902+YensJwsl32XzvAZu6d5FC+gJ//VzKZ3+TLMWITXBTOvPbywvH hV5V+DsmM5Nx5vvRVHQGaiCnZB2KvkzL1w4y9nFhe7QpSHw1ja2vpg== -----END RSA PRIVATE KEY-----
encryptedString = Ul1AuHajJ1Qccj1jj+8IRLs2lPfHvi0eYvbBmlOOncj6g8SusfLFgmfx8EXk9gKcA8DdsNySMNtMaUiDxGvk+8G8nFekkIY4BElzxCP1BM8htnrUQplHkokSwEG14O/JVAuJCcyyCLFy0h38VERVHajVfeQY7cUAYmqCJcunIQz98Oj/cmoKAn9GjmnDXcCYg5cCEwId9nSpeP+KWvfgfUNkaEN4knhCLJojp52dJF+taZd29OProu3KS/PLAQN22Fve/2CgPTCRKy0OemT72KGhcZNot9WVgS17qik4usYONDSJoeyDQRf5zs7lPdk7PgbtA7wJSQ/Csr2huql3yJKit48FCxP53A6S8yn6KX9lx2OUH8bRa0WpE4JdNp759+TWyfBBTxGF60y55Q4ZgaELpU5OyvHHBDy4GUjcUgbA1GZc4NEFQJsCnr+XjOPKXzigpHSNe7KgqPFr9YuvByqDgNMcS+rx9e8N2Vpp2ExeQLAonO5wufxYACAZBVHo
Algorithm used:
await RSA.decryptPKCS1v15(message, privateKey)
I guess the lib is not compatible with Node-RSA keys for asymmetric decryption
seems like is something related with the privateKey, looks like you are using 3071 for the bitLen but is something that is not supported at this moment, how are you creating you keyPair ?
ok thank you for your response, in that case I guess the max supported bitlength is 2048
Hi, I tried decrypting an encrypted string sent to the client-side using a privateKey generated using Node-RSA on the server-side with
decryptPKCS1v15(message, privateKey)
and I got aError: stringResponse: crypto/rsa: decryption error
PrivateKey is a PEM string and crypto was gotten from browserify, pls what am I missing. Meanwhile the privateKey works fine with Node-RSA just that it is slow decrypting small size of data