JoshKaufman / ursa

URSA - RSA public/private key OpenSSL bindings for Node.js
Other
619 stars 135 forks source link

How to disable padding for encrypt method #170

Open sourav2029 opened 6 years ago

sourav2029 commented 6 years ago

The doc: https://www.npmjs.com/package/ursa#public-key-methods states that the input buffer is limited to be no larger than the key size minus 41 bytes.

I tried disabling the padding that is used by passing RSA_NO_PADDING option, but it also doesn't work.

The error that I get is : error:0406B06E:rsa routines:RSA_padding_add_none:data too large for key size.

My input length is 256 bytes.

If it helps, I am trying to replicate some python code which uses this function:https://www.dlitz.net/software/pycrypto/api/current/Crypto.PublicKey.RSA._RSAobj-class.html#encrypt