PGP Encryption Key Usage

136 views Asked by At

Can I use the same key pair generated on my windows environment in Linux Environment to decrypt? Suppose I generate a key pair using python-gnupg in my windows environment and encrypt a file. Can I use the private key of this generated key in my Linux environment to decrypt the message?

1

There are 1 answers

0
Blckknght On BEST ANSWER

The real question here is how can you securely transfer your private key from one system to another? If you have a secure means of file transfer, you could probably use it for the main file instead of just for the key, and an extra layer of encryption is probably unnecessary.

If you cannot securely transfer any files, then you shouldn't send any plaintext or secret keys between systems. Fortunately, this is a situation where public key encryption shows its strengths. You can create two separate key pairs, one for each system. You only need to have each system send the other the public key of the key pair, the private keys are never taken off the system they were created on. You don't care if an attacker is able to get a copy of those public keys, indeed, some public keys are published on the internet!

When you have a file you want to securely send from one system to another, you use the public key for the recipient to do the encryption. The sender may also want to sign the file with its own private key (so the integrity of the file can be verified at the other end). The encrypted (and signed) file can then be transported by less secure means from one system to the other, without too much fear of an attacker getting a copy, since it will be very hard for that attacker to crack the encryption. The recipient can decrypt the file using their secret key (and verify the signature using the public key of the sender).