I'd like to work out a way to encrypt arbitrarily large files using users' RSA key pairs they generated for SSH purposes. They have standard id_rsa and id_rsa.pub files, and a PEM version of the pub file too. I'd like to reuse these keys for this purpose.

Rather than encrypt the file with AES and then encrypt the secret using the RSA keys, I would like to use a process which involves the generation of just a single encrypted file.

Something like This article where openssl smime is used, but it requires a cert and key as opposed to pub and private keys. It seems to me there should be a way to this with RSA pub/priv keys, but I can't work it out.

  • You don't generally encrypt large amounts of data with RSA. Hybrid encryption (most data encrypted with a symmetric cipher like AES, symmetric key encrypted with RSA) is the way to go. However, I have no idea how you would use OpenSSH keys for this. – Tom Hunt Oct 22 '15 at 16:45
  • 3
    The more usual software for file encryption is PGP/GPG, which does the hybrid encryption transparently and makes one encrypted file. But that requires making a new key with that software. – Tom Hunt Oct 22 '15 at 16:45
  • Thanks for the response Tom. I guess I was kind of hoping that there would be an option out there - was hoping to keep things as simple as possible for my users. Never mind! – Olly B Oct 23 '15 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.