[erlang-questions] crypto rsa encryption

Trevor Woollacott <>
Fri Oct 29 18:11:04 CEST 2010


> It really works.
> Thank you.
>
> --
> Sergei Fomin
>
>  wrote:
>>> Hello.
>>>
>>> I'm trying to get rsa encryption with crypto module. With PKCS1 padding
>>> scheme it works ok, but 'rsa_no_padding' option makes
>>> crypto:rsa_public_encrypt to raise:
>>> ** exception error: encrypt_failed.
>>>
>>> My system:
>>> otp: R13B03, R13B04, R14B
>>> Ubuntu 9.10
>>> OpenSSL 0.9.8g 19 Oct 2007
>>>
>>> Any ideas what the problem is?
>>>
>>> --
>>> Sergei Fomin
>>>
>>
>> Hi Sergei
>>
>> With RSA_NO_PADDING the size of your input needs to be exactly the same
>> size as your RSA key, otherwise you need to add padding yourself.
>>
>> Regards,
>> Trevor
>>
>>
>>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>

Ok, great:) Just a note: if you aren't using one of the usual
cryptographic padding schemes and you use RSA_NO_PADDING, then you still
need to implement some other secure padding scheme in your application
code to make sure that your encrypted value is secure.

Regards,
Trevor



More information about the erlang-questions mailing list