hohl / MIHCrypto

OpenSSL wrapper for Objective-C [cryptography]
MIT License
341 stars 68 forks source link

Several improvements around RSA crypto #28

Closed 4ndrey closed 9 years ago

4ndrey commented 9 years ago

Since RSA is asymmetric cryptography sometimes it is useful to have an ability to encrypt with private key and to decrypt with public key in addition to common approach. I extended MIHPrivateKey and MIHPublicKey protocols to support it in addition to MIHRSAPrivateKey and MIHRSAPublicKey updates.

Another thing is that forcing RSA_PKCS1_OAEP_PADDING is not useful for general approach. So I have added ability to customize rsa padding via special property of MIHRSAPrivateKey and MIHRSAPublicKey.

hohl commented 9 years ago

Thank you very much for helping improving this project. However can you please add some unit tests for your changes?

4ndrey commented 9 years ago

Sure! Please review them. Also I propose set default rsa padding to RSA_PKCS1_PADDING since it is more standard value in comparison with RSA_PKCS1_OAEP_PADDING.

hohl commented 9 years ago

I wasn't aware of RSA_PKCS1_OAEP_PADDING is more popular. The tests seems valid and again thank you for spending your time on helping on this project.