Skip to main content
1 of 4
user
  • 111
  • 1
  • 6

Tool for public key cryptography where password is the private key?

Is there any free & open source tool for public key cryptography, where the private key is just a chosen password?

Here is what I need:

  • I want to make backups
  • every hour
  • from a script
  • using open source tools.
  • The backups must be encrypted,
  • but I need to be able to decrypt them without any files.

I cannot use symmetric encryption for backups, because the password cannot be given in the script in plaintext, and I cannot be asked each time a backup is made for the password (e.g. because when I'm on 1-month holidays, the backups need to be still made).

So I thought about public key cryptography, but all tools that I read about store the private key in a file. I'm afraid of loosing it, just like all other data (that's why I'm doing backups in the first place). Imagine my disk suffers hardware failure, someone steals it, it burns in a fire, etc. Sure, I have backups, but I can't decrypt them without the private key file, which is now lost! Of course I could have backups of my private key file, but I simply don't want to rely on a file to decrypt my data.

I found a solution (at least from mathematical point of view, because I can't find any tool implementing this). Let's say I have my password. Let us generate a pair of prime numbers (p1,p2) using the following function p2rsapk:

(p1,p2) = p2rsapk(password) = {
  bits = password as vector of bits
  (n1,n2) = split bits into two parts in deterministic way, e.g. just take halves
  p1 = find prime based on n1, e.g. lowest prime p1 s.t. p1 > 2^n1-2
  p2 = find prime based on n2
}

Voila! We have just taken a password and turned it into our private/public key pair. Now I could encrypt my backup with the public key (used by the script), and decrypt it when I have to without the need for any private key file (because my password IS my private key with the help of the p2rsapk function).

I could also send my public key to friends, so they can send me encrypted messages, and I can decrypt them from anywhere without the access to my no-longer-needed private key file.

However, while the idea is quite simple, I haven't found any tool that implements it. Is this approach known? And are there tools for this?

user
  • 111
  • 1
  • 6