Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1640  / 1 Year ago, sun, february 12, 2023, 4:01:10

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?


More From » encryption

 Answers
0

Finally I managed to solve my problem. Although in a different way.



I installed thunderbird, created an account for my email address. Next I installed enigmail extention. From enigmail setup wizard I created key-pair for my acoount and a revocation certificate.



But here problem was still not gone. I went to enigmail key management then right clicked on my key and selected upload to public key server. But constant error was coming. It was because enigmail was unable to add the keys to my trusted keyring.



So I once again right clicked on my key and selected export key and then enabled export of private key and clicked OK. Let us assume that I had given the name to the output file mykey-pub-sec.asc



Next I went to the terminal and typed:



cd /path/to/the/saved/file
gpg --allow-secret-key-import --import mykey-pub-sec.asc
gpg --keyserver keyserver.ubuntu.com --send-key $GPGKEY


Here I replaced $GPGKEY with the key ID



That's it job done


[#14891] Tuesday, February 14, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
armis

Total Points: 38
Total Questions: 106
Total Answers: 118

Location: Mali
Member since Sat, Feb 12, 2022
2 Years ago
;