0

I'm looking for a minimal C library that would allow me to encrypt and decrypt a string using RSA. I found that bearssl would be a really good candidate but unfortunately I have not understood how to do it. Can anyone help me with that? I'm open to other suggestions in terms of libraries.

Thanks a lot

Alberto
  • 446
  • 5
  • 14
  • Mote that rsa is just the text to the power of the key modulo the public modulus. (Both encryption and decryption) – dan1st Mar 06 '20 at 20:42
  • Possible duplicate of https://stackoverflow.com/questions/14026768/library-for-rsa-implementation-in-pure-c – dan1st Mar 06 '20 at 20:45
  • @dan1st If you call RSA is just the text to the power of the key modulo the public modulus then start reading [Twenty Years of Attacks on the RSA Cryptosystem](https://crypto.stanford.edu/~dabo/papers/RSA-survey.pdf) – kelalaka Mar 07 '20 at 07:58
  • We usually don't encrypt RSA. We prefer a hybrid cryptosystem where public-key cryptography is used for key exchange/transmit and a symmetric key to encrypt the message. What is your aim here? – kelalaka Mar 07 '20 at 08:04
  • @kelalaka this seems like problems with the keygen or e.g. problems if you have hardware access. In this case you can also just read the memory and extract what you need. – dan1st Mar 07 '20 at 08:25
  • @dan1st What about [Bleichenbacher](https://crypto.stackexchange.com/q/64648/18298), ROBOT, etc. and side channel attacks. – kelalaka Mar 07 '20 at 08:37
  • @kelalaka thanks for your comment. The goal is just to securely encrypt a blob of data using an asymmetric encryption algorithm. dan1st thanks for your comment, I'm aware of the theory behind it but I'd like to rely on bearssl because of its minimal footprint without rewriting the algorithm – Alberto Mar 07 '20 at 11:47

0 Answers0