Search code examples
pythoncryptographyrsaprivacyencryption-asymmetric

what python package for rsa algorithm


looking to do RSA encryption on a short string in python. This is for a piece of user data that I want to store without staff (incl myself) being able to see it. The private key will be on a thumbdrive in my safety deposit box for when we get subpoenaed.

my question: is there a 'probably correct' python package for asymmetric-key RSA? Will I be safer to use a C library (if so which one).


Solution

  • Encryption of short strings with RSA can be problematic. There are certain pieces of data you can encrypt with RSA that reveal details about your private key. In your case it will probably be fine since it will be obscure enough your staff won't figure it out. But in the general case, with a knowledgeable and/or well-funded adversary, you do not want to use RSA to directly encrypt data if you want that data to be kept secret.

    I would recommend just using gnupg instead. It's solved all those problems for you.