Altcoins Talks - Cryptocurrency Forum

Further Discussions => Blockchain Technology => Topic started by: Learn Bitcoin on March 23, 2024, 07:53:15 AM

Title: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: Learn Bitcoin on March 23, 2024, 07:53:15 AM
Hi Altcoinstalks

This thread was posted on Bitcointalk as well. The author is me.

As Husna QA suggested (https://bitcointalk.org/index.php?topic=5469280.msg62952506#msg62952506), I decided to write a tutorial for Linux users.

Quote
(https://talkimg.com/images/2023/11/05/tsHtJ.jpeg)
Image source: encriptados.io


➥ More PGP Tutorials:


➥ Install Gnupg and gpa:

Let's get started!
Open your terminal and paste this command line
Code: [Select]
sudo apt-get install gnupg2 gpa
If you have given the root privilege already, it won't ask for the password. If you haven't, please write your system password, and it should install gnupg2 and gpa. Look at the screenshot below;

Quote
(https://talkimg.com/images/2023/11/05/tsCMv.png)


➥ Generate Key:
Paste this command line in your terminal
Code: [Select]
gpg --full-generate-key, and it will ask what kind of key you want to generate. RSA and RSA are the default, and I will generate the RSA and RSA one. To generate RSA and RSA keys, type 1 and enter.

RSA keys can be from 1024 bits to 4096 bits long. 3072 is the default one, but I am creating 4096 here. So write 4096 and hit enter. See the image below;

Quote
(https://talkimg.com/images/2023/11/05/tsQJH.png)

Now, you can set the expiration date of your keys. 0 defines the key won't expire. I am going with 0. Write 0 and hit enter. Write Y and hit enter again.
It should ask for your real name (You don't have to write your real name, of course), email, and comment. I am writing mine. Then, write O and hit enter again. It will ask for your passphrase, write your passphrase, and it should generate your keys. See the image below;

Quote
(https://talkimg.com/images/2023/11/05/tsmSI.png)
(https://talkimg.com/images/2023/11/05/tsGbg.png)

Now paste this command line
Code: [Select]
sudo gpaIf you do not get any errors, please skip the next part.


If you get the error
Code: [Select]
failed to load module canberra-gtk-module it could be a reason for being unable to create your keys even though it shows the keys were generated. If you are on an Ubuntu or Debian system, first apply this
Code: [Select]
sudo apt update and then install Libcanberra 
Code: [Select]
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module -y
After that, again try
Code: [Select]
sudo gpa, and it should open the GUI of GNU Privacy Assistant, and you can create your keys from here. I believe you already know how to do that.

Ok. I have generated my keys already, and you can see them below;

Quote
(https://talkimg.com/images/2023/11/05/tsyX8.png)


➥ Export Public Key:
To export your public key, right-click on your key and select Export keys...

Quote
(https://talkimg.com/images/2023/11/05/tsYBZ.png)

Select your destination and write a name with .txt extension. In my case, I wrote publickey.txt

To see your public keys, open the file. In my case, this is my public key
Code: [Select]
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGVGVnoBEACsg6GWMYbztqxe0bKbiCZ12/ngcPaw6IKPd/g8RfIIuqISEgGU
hfvj0ulted8RKm0kL/kEG782EpbAVHEIIbnU0tluhLG6z9EieLfXWkmT9JEZViKR
JylFDDsxYJ5cWlccTNddfIAxZ5PWS445TVUDTnApaw68gciXoq5K3v70nZZUD/Of
z3UTWhleUqI5/nKTQNJtgdGvGS4kDGZ/i1AZkd1xuoSP7ezjtMuPP2BjgoFicpJG
KD6DAcPSJce/7aTZP45LHYg1mazzU8jXxHC8byoxPuRFGFRAQ+cv3CnJw9eIdOB6
aGRWxA+HKmuBDHVzMPtvEF9CP4xHB1Ko6b3p4bM0yEpgn/QObtkLirvim2PyzycH
DLK6tjGmhXAjoFYNTiyK0chja59nAPIFxg0/SxhKdUqPBGJMrrx+WF+sWcj3IsOW
01rWKwF+5nUyUAejDQDTEfFpAi8Veg8M8O6uXSrcQDsfjPo6UKWvOWU6v1cbI8Lw
FFv72iQmK21P/CXtEWTBpP/b2nJNe6FnTRtWyNiBd9mADq0c7JXnmI+AHUApECzi
3/sWTrLGqmLhTjwWSMtu7T5YnkbA6Gi6Rdou9aU0X7fWHMG3r7hd6yRV94H5GHC4
54kcfMIbRNFIR2t4lymrmX55uatWvnwVTD/UcdionLdM+zMe3zGb+95BGQARAQAB
tDVMZWFybkJpdGNvaW4gKHRleHQgcGdwKSA8bGVhcm5CaXRjb2luQHByb3Rvbm1h
aWwuY29tPokCTgQT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JyzL+VpqFydpf5IMAVwhb0XSxI5VwX
N/5nH3IgEDUBSt5bEfAmiaSxsth3SakSeRYG5ICkTr4RSOqHVBdAEODWBGMIqCdd
gFy/cFXnbPeYtqGrdUCuKq8=
=t6jo
-----END PGP PUBLIC KEY BLOCK-----


➥ Export Secret Key:

To export your Secret key, right-click on your key, select Backup, and save the file. It will ask for your passphrase.

Quote
(https://talkimg.com/images/2023/11/05/tscpo.png)


➥ Send Encrypted Message:

Now, I am going to send an Encrypted message to BitcoinGirl.Club using his Public Key:

Quote from: BitcoinGirl.Club on July 31, 2023, 09:48:43 PM (https://bitcointalk.org/index.php?topic=1159946.msg62629929#msg62629929)
Code: [Select]
-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEZMghNBYJKwYBBAHaRw8BAQdA+IDRMqmKdzj0eiBee8MjUJ71Sl11HJDEKwuv
eONy9We0ImJpdGNvaW5naXJsIGNsdWIgPGJnY0Bub2VtYWlsLmNvbT6IkwQTFgoA
OwIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBFDZejW2cobfuR3fPWOx
Ut7+xyg9BQJkyCG+AAoJEGOxUt7+xyg9E5MA+wS51d5leJ0noKkZlEfAjEqBt/ca
li0mfmKfw9U5LXLrAQC3ncYEyJHrzlNXAav1myyvKZEXQ1WAGafIHeRdcleJALg4
BGTIITQSCisGAQQBl1UBBQEBB0ChNUGhTHWOLKkMNBXFG6/Rl/wWrZ4ad3ppaKtA
Cs3BLwMBCAeIeAQYFgoAIAIbDBYhBFDZejW2cobfuR3fPWOxUt7+xyg9BQJkyCHK
AAoJEGOxUt7+xyg9l9YA/RKyt4OQVeDb1coppNdMVsptCnfB+66fShrn1ij7n9XA
AP4ntoJBo0w4PDIbuCEtOPRjUAk+pC3iaaC2Dq1hU4b+Bw==
=wFDZ
-----END PGP PUBLIC KEY BLOCK-----

I have saved his Public key block in a .txt file and imported it. See the image below;

Quote
(https://talkimg.com/images/2023/11/05/tsoZT.png)

Now click on the Windows tab and click on Clipboard.

Quote
(https://talkimg.com/images/2023/11/05/ts43l.png)

Write your message, click on the file, and choose encrypt (See the image below):

Quote
(https://talkimg.com/images/2023/11/05/ts5B1.png)

Now click on Bitcoingirl's public key and click on the sign, too. It will ask for your passphrase; enter your passphrase and boom! Your encrypted message will appear in your Clipboard.

Quote
(https://talkimg.com/images/2023/11/05/tsBzW.png)

(https://talkimg.com/images/2023/11/05/ts9dm.png)

Code: [Select]
-----BEGIN PGP MESSAGE-----

hF4DHD+iqLgO/5wSAQdAYQqzh5+Bj9mNagMn0ZXEzOG6wNFCBiXxpMnSMPDCr00w
rvpcDpcGPifQOTSeW++yX+gEAUwh3Nuz2chHSe2m5mRIthHNbXZXVLqnqDGAp5G3
0ukBFTQutKV3HrFTnSBc9IauNim5EdqywFRRigNsxG5z6VWCR7ecQtqYmEnvHNFv
orgPj2KC90VJ0eA1IZ/OzNyW7VqXrcDaH+0iUAFrlkEN9jf+d+OzpBvVLf8H8WZc
lSi2zP+GdSgA0ITIM6gWhirA/wkeOBXPE9H4eiq+da36JYmUSRxGHR7AZlmt/v+W
OD8REjHxSISWvMbuN703QKV6KVZ0K4JOEQaIdeRu6zYDueMV+YNGMC8eH8doMFlT
yPpJbi8MM+qFTuno+iDCR/2HzdAUVGrExzIr4ZZoIkCaOlmL8ZIJBcnMVnjySVFJ
t+Wb3fspFERX8jnw8pyt4l2EUbpY1F+OQ4YOGhvkZd3rbPkt9qRE+JUvPUx+Carz
RX08qe5qHVvjajfppewoypDkXto5wfDILIVEyIuhqo1/aIFyEhXdRO6sWqt2EeGA
+XQpgfd6xWhEESk3lq+bTDHseqzI1Hs4Dng4Yjdx0L2Y91Ag9tj/cyyKyHi0nMam
/t1SBpMSotfV3CnCUdMh9gHdok43e9b5hObXVpd7jjU2PH443xvfrZtiKlvvGUdd
fUZuMFilx7Clfm4YukrzM6ntg2U+uINRKDLWaf1JA2zd4DET41gNdgkTNQxnT/It
02hrqyI+TfjzhdP6Kls4O2e4hhusIXqtKwut0W2zjfc7YqhA3SBHOJJjd2d4xoky
Kn7AK8xh+RcLWhDAVMV+/NJkJKjveLpgbrtw/0QU/WM1V8e5RGedtlJUHjwS6s34
QnHrgOFDmnSsachXKxv53kzwGNkmtzdoLFedQTLXWu16rlSlO7bbPTTP8YiXDxOJ
WkC7xNbERFdTC51pd2moWJfot4mp8kpKN22ItZZvRIYIkDX2a01xOP1aflDCszuB
+YRdjN991l81KiY=
=WwRm
-----END PGP MESSAGE-----

There we go. We are done already. Let me know if I made any mistake here because I have been using Linux for a month only.
If you face any problem, post here, and I will try to help fix it. Even If I couldn't do it, there are a lot of community members who can step up.
Title: Re: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: Husna QA on April 13, 2024, 12:53:54 PM
-snip-
➥ Send Encrypted Message:

Now, I am going to send an Encrypted message to BitcoinGirl.Club using his Public Key:

Code: [Select]
-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEZMghNBYJKwYBBAHaRw8BAQdA+IDRMqmKdzj0eiBee8MjUJ71Sl11HJDEKwuv
eONy9We0ImJpdGNvaW5naXJsIGNsdWIgPGJnY0Bub2VtYWlsLmNvbT6IkwQTFgoA
OwIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBFDZejW2cobfuR3fPWOx
Ut7+xyg9BQJkyCG+AAoJEGOxUt7+xyg9E5MA+wS51d5leJ0noKkZlEfAjEqBt/ca
li0mfmKfw9U5LXLrAQC3ncYEyJHrzlNXAav1myyvKZEXQ1WAGafIHeRdcleJALg4
BGTIITQSCisGAQQBl1UBBQEBB0ChNUGhTHWOLKkMNBXFG6/Rl/wWrZ4ad3ppaKtA
Cs3BLwMBCAeIeAQYFgoAIAIbDBYhBFDZejW2cobfuR3fPWOxUt7+xyg9BQJkyCHK
AAoJEGOxUt7+xyg9l9YA/RKyt4OQVeDb1coppNdMVsptCnfB+66fShrn1ij7n9XA
AP4ntoJBo0w4PDIbuCEtOPRjUAk+pC3iaaC2Dq1hU4b+Bw==
=wFDZ
-----END PGP PUBLIC KEY BLOCK-----

There is a slight correction regarding the BBcode you use in the post quote; You cannot directly use the link in other forums (SMF), such as from Bitcointalk to Altcoinstalks and vice versa.

If you click on the quote link as in the public key example above, then instead of referring to the post link on Bitcointalk, you will be directed to the following Altcoinstalks link:
https://www.altcoinstalks.com/index.php?topic=1159946.msg62629929#msg62629929 (https://www.altcoinstalks.com/index.php?topic=1159946.msg62629929#msg62629929)

(https://i.ibb.co/jGtYR1B/Screen-Shot-2024-04-13-at-17-37-27.png)

Below, I've modified the BBCode to match the original link:

Quote from: BitcoinGirl.Club on July 31, 2023, 09:48:43 PM (https://bitcointalk.org/index.php?topic=1159946.msg62629929#msg62629929)
Code: [Select]
-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEZMghNBYJKwYBBAHaRw8BAQdA+IDRMqmKdzj0eiBee8MjUJ71Sl11HJDEKwuv
eONy9We0ImJpdGNvaW5naXJsIGNsdWIgPGJnY0Bub2VtYWlsLmNvbT6IkwQTFgoA
OwIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgBYhBFDZejW2cobfuR3fPWOx
Ut7+xyg9BQJkyCG+AAoJEGOxUt7+xyg9E5MA+wS51d5leJ0noKkZlEfAjEqBt/ca
li0mfmKfw9U5LXLrAQC3ncYEyJHrzlNXAav1myyvKZEXQ1WAGafIHeRdcleJALg4
BGTIITQSCisGAQQBl1UBBQEBB0ChNUGhTHWOLKkMNBXFG6/Rl/wWrZ4ad3ppaKtA
Cs3BLwMBCAeIeAQYFgoAIAIbDBYhBFDZejW2cobfuR3fPWOxUt7+xyg9BQJkyCHK
AAoJEGOxUt7+xyg9l9YA/RKyt4OQVeDb1coppNdMVsptCnfB+66fShrn1ij7n9XA
AP4ntoJBo0w4PDIbuCEtOPRjUAk+pC3iaaC2Dq1hU4b+Bw==
=wFDZ
-----END PGP PUBLIC KEY BLOCK-----

(https://i.ibb.co/3kd4ykK/Screen-Shot-2024-04-13-at-17-58-00.png)
Title: Re: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: Learn Bitcoin on April 13, 2024, 01:57:05 PM
If you click on the quote link as in the public key example above, then instead of referring to the post link on Bitcointalk, you will be directed to the following Altcoinstalks link:
https://www.altcoinstalks.com/index.php?topic=1159946.msg62629929#msg62629929 (https://www.altcoinstalks.com/index.php?topic=1159946.msg62629929#msg62629929)

Oh wow. I didn't event notice that. Thanks for pointing it out and the fix as well. I have updated the OP as well. Thanks again for pointing it out. I will have to update the thread of the Android tutorial as well because I have posted the same as this one. I have to check if there are corrections or not. Moreover, I am happy to say that the Android thread has received over 12 translations so far, and you did it for your local board on BitcoinTalk. Thank you for the effort. I will update the header with all the translations link.
Title: Re: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: babo on April 18, 2024, 02:50:57 PM
thank you on behalf of the community, articles like this are useful
I am aware and have been using pgp for a long time, but many people don't use it because they think it's difficult
ditto for complex password managers, people think it's difficult, get annoyed and then use the same password for many services

thanks

with this tool https://pgptool.org/ you can try without installing nothing
Title: Re: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: Husna QA on April 26, 2024, 05:30:03 PM
thank you on behalf of the community, articles like this are useful
I am aware and have been using pgp for a long time, but many people don't use it because they think it's difficult
ditto for complex password managers, people think it's difficult, get annoyed and then use the same password for many services

thanks

with this tool https://pgptool.org/ you can try without installing nothing

Even though it's instant and could be easier because you don't have to bother installing anything, I don't recommend using a web-based tool like that, mainly if it can only be used online, as stated in the description of the "PGP Tool".

You must input the signer's private key for encryption or decrypting purposes.

(https://i.ibb.co/vqnN3SN/Screen-Shot-2024-04-26-at-22-31-10.png)

Are you sure the tool is safe and does not spy on the private key you are using?
Title: Re: [Eng: Tutorial] PGP Signature - Encrypt/Decrypt message (Linux Only)
Post by: babo on April 30, 2024, 11:12:04 AM
thank you on behalf of the community, articles like this are useful
I am aware and have been using pgp for a long time, but many people don't use it because they think it's difficult
ditto for complex password managers, people think it's difficult, get annoyed and then use the same password for many services

thanks

with this tool https://pgptool.org/ you can try without installing nothing

Even though it's instant and could be easier because you don't have to bother installing anything, I don't recommend using a web-based tool like that, mainly if it can only be used online, as stated in the description of the "PGP Tool".

You must input the signer's private key for encryption or decrypting purposes.

(https://i.ibb.co/vqnN3SN/Screen-Shot-2024-04-26-at-22-31-10.png)

Are you sure the tool is safe and does not spy on the private key you are using?

I don't recommend using it every day either
I recommend it for testing and testing and to understand how pgp works
so you don't litter your system with tests
It also becomes convenient because you can share the screen with a friend who understands PGP and have it explained to you by clicking on the site

It's a very useful tool for learning and testing