Last night my system shutdown unexpectedly and when i restart it, it gave me superblock error. will then i fixed a little but. i was able to retrive my encrypted files which i encrypted my pgp public key but i was not able to retrive my private key or public key

now i have ecrypted file which cannot be open because i have lost my private key.

is there any way that i can encrypt my file by providing only master password and passphrase and no physical key or private key

and when i am on another computer i can easily open it my same master password and passphrase.

2 Answers
2

is there any way that i can encrypt my file by providing only master
password and passphrase and no physical key or private key ... and
when i am on another computer i can easily open it my same master
password and passphrase.

Yes, definitely.
Every time you try to encrypt some input, GnuPG actually generates a random session key which it then uses to symmetrically encrypt the input (using whichever cipher-algo is specified -- CAST5 by default). Then the session key is encrypted with any combination of passphrases & gpg public keys and THOSE are what you use to access the data.

Here's an example of running gpg to encrypt some data and make it accessible via both a simple passphrase and a couple public keys:

gpg -cer barack@devnull --cipher-algo aes256 -r bob@devnull <FILE>

Note that cipher-algo is of course optional.

EDIT:
Per request, here's a simplified example which only uses a symmetric key.

gpg -c --cipher-algo aes256 --force-mdc <FILE>

See the man page for an explanation of --force-mdc, but note that I added it on purpose; by default it's not used when only doing -c/--symmetric.

Can you explain why did you use barack@devnull and bob@devnull, i think this will use public key to encrypt, can you provide a code which will only take passphrase and master password and no public key. Thanks
–
IoriSep 5 '12 at 13:24

@lori: Hopefully it should be clear to you now. If you're wanting to do gpg symmetric / symmetric+asymmetric often, you might be interested in checking out my gpg frontend. When running it from a terminal, it even prints out what gpg command it used.
–
rsawSep 5 '12 at 14:57

No, you need the private key to decrypt a file that has been encrypted with the public key. That's by design: someone who somehow obtains the password would also need the key to decrypt your files. In fact, the private key is all you need to decrypt the file; in your keyring, the private key is stored encrypted with your passphrase.

Since you can decrypt the file on the other computer, copy your keys back from that other computer. And make sure you have ample backups of your key! Print it out and store the paper somewhere safe: it would be really tedious to type the key back in, but paper is durable, so it might save you.

All this assumes that the files are encrypted with the private key (with gpg -e). Gpg can also encrypt a file with only a passphrase (with gpg -c). If that's what you did, it's independent from any key, all you need is to type the passphrase.

Thanks for the reply, i see 'gpg -c' can also have AES356 encryption but which one will be better only passphrase or with public and private key, which will be more secure. Thanks
–
IoriSep 5 '12 at 0:35

@lori “Which will be more secure” has no answer. Which is faster: a car or a train? It depends where you're traveling. For example, using your private key means that an attacker would have to obtain two things, your keyring and your keyring passphrase. If you encrypt with only a passphrase, the attacker may be able to guess the passphrase. On the other hand, if you use a passphrase that's specific to the file, you can give out the file to other people with that passphrase.
–
GillesSep 5 '12 at 0:43