GnuPG generating public/private key pair where public key and Private key are same and not different
I want to generate GnuPG public private key pairs. I have gpg
and not gpg2
installed.So I went to terminal and did:
gpg --gen-key
output:
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
I selected 1
Output:
What keysize do you want? (2048)
I selected 4096
Output:
Key is valid for? (0)
I selected 0
Output:
You need a user ID to identify your key;
the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Name Title (some comment) <[email protected]>"
Real name: My Name
Email address: [email protected]
Comment: comment
You selected this USER-ID:
"My Name (comment) <[email protected]>"
Output:
You need a Passphrase to protect your secret key.
I gave passphrase Output:
gpg: key XXXXXXXL marked as ultimately trusted
public and secret key created and signed.
pub ABCDE/XXXXXXXL 2016-06-09
Key fingerprint = XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXXL
uid My Name (comment) <[email protected]>
sub ABCDE/XXXXXXXM 2016-06-09
I added the following line to my ~/.profile
:
export GPGKEY=XXXXXXXM
Then to source it I did
killall -q gpg-agent
eval $(gpg-agent --daemon)
export GPGKEY=XXXXXXXM
Next I encrypted it:
gpg --cert-digest-algo=SHA256 --edit-key XXXXXXXM
Output:
Secret key is available.
pub ABCDE/XXXXXXXM created: 2016-06-09 expires: never usage: SC
trust: ultimate validity: ultimate
[ultimate] (1). My Name (comment) <[email protected]>
Command>
I did
addkey
Output:
Please select what kind of key you want:
(2) DSA (sign only)
(4) Elgamal (encrypt only)
(5) RSA (sign only)
(6) RSA (encrypt only)
I selected 6
Output:
What keysize do you want? (2048)
I selected 4096
Output:
Key is valid for? (0)
I selected 0
Output:
pub ABCDE/XXXXXXXL created: 2016-06-09 expires: never usage: SC
trust: ultimate validity: ultimate
sub ABCDE/XXXXXXXM created: 2016-06-09 expires: never
sub ABCDE/XXXXXXXN created: 2016-06-09 expires: never usage: E
[ultimate] (1). My Name (comment) <[email protected]>
Command>
I did:
save
Next I did:
gpg --list-keys
This is my sample output:
pub ABCDE/XXXXXXXL 2016-06-09
uid My Name (comment) <[email protected]>
sub ABCDE/XXXXXXXM 2016-06-09
sub ABCDE/XXXXXXXN 2016-06-10
However when I do
`gpg --list-secret-keys`
I get de-to-de the same output with the exception of sec in place of pub:
sec ABCDE/XXXXXXXL 2016-06-09
uid My Name (comment) <[email protected]>
sub ABCDE/XXXXXXXM 2016-06-09
sub ABCDE/XXXXXXXN 2016-06-10
I know that the portion after pub ABCDE/
is the public key and the portion after sec ABCDE/
is the private key. So in short, my public key and private key are the same.
Another peculiar scenario is that here three lines start with ABCDE
, but the combination has to be different.
How can I get separate public and private keys?