PGP/GPG Guide

Informasjon,guider og tips relatert til PC og Teknologi
Post Reply
Spesialisten
Godkjente Selgere
Godkjente Selgere
Posts: 17
Joined: Tue Sep 10, 2019 6:39 pm

PGP/GPG Guide

Post by Spesialisten » Thu Sep 19, 2019 2:59 am

- Genererer ett nytt nøkkelpar

└──╼ $

Code: Select all

gpg --full-gen-key
gpg (GnuPG) 2.2.17; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

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)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 0
Key does not expire at all
Is this correct? (y/N) y

- Velg navn (ikke bruk ditt ekte navn , gjerne ett alias)

GnuPG needs to construct a user ID to identify your key.

Real name: testing
Email address: testing@testing
Comment:
You selected this USER-ID:
"testing <testing@testing>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

- Du blir bedt om å oppgi passord (bruk ett langt vanskelig passord) - Derretter må du vente mens nøklene blir generert


We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 67BE77F0CAA154B5 marked as ultimately trusted
gpg: revocation certificate stored as '/home/user/.gnupg/openpgp-revocs.d/74D867B01C692309FD0587E967BE77F0CAA154B5.rev'
public and secret key created and signed.

pub rsa4096 2019-09-19 [SC]
74D867B01C692309FD0587E967BE77F0CAA154B5
uid testing <testing@testing>
sub rsa4096 2019-09-19 [E]

-Key Id , subkey ID og Fingerprint



──╼ $

Code: Select all

gpg --list-key --keyid-format 0xlong --fingerprint testing
pub rsa4096/0x67BE77F0CAA154B5 2019-09-19 [SC]
Key fingerprint = 74D8 67B0 1C69 2309 FD05 87E9 67BE 77F0 CAA1 54B5
uid [ultimate] testing <testing@testing>
sub rsa4096/0x89AF2749B56D6C05 2019-09-19 [E]

- Print ut public key block fra terminal


└──╼ $

Code: Select all

gpg --export --armor testing
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF2CzQUBEADoqRXTBrwWEt0Vzc44++sQxAqumpmQtXfou/zLwlv5NkQpSZ2r
OkFhD5GSDBOqTfVnBowNrJr93GxNRs7ZwLR8Il+T/ksqO4Py6UBv4jeMe6RCm064
0BEMg/ipF184DYudrM5k56a+bZOYyOk+EqBRp7nwf4rWLbUZvSbBgVem5dp9wajR
4/e4++TxSEiVqF/5jTQ1u56bS153jz4asBKXz4OAXa2lb8LcRIACGT9f0xTT7DSJ
Lzo1bVQD5LeLUeEwDwi0vcHLw0ofAnaXlGteBltqTVLFMbg1KegNmISOD/74PCS3
4O4gw9CWfkwaXE/0TWt1f3DUF4GzfVE39+xTMmcY6cRJRH5BPPtVMC2lTmS/iSG9
LUphIoVWIVIs8HXONL4enM2Ect6JWGVgG9qDK2OLzfgT165rjcm/L60O9h9t4DTE
PzTfQcgADEBaEZ/vlum/IO0yPEhohHCHApP0AwQvLBWumNtYshxouGgquLBbPhZX
AQJir7McYcuUlCRr0xAetrdJ2CQKDhhWfJ80mqD4dsrcLfIXFErRf/l0LW/np1/s
jVJAOshYMVRPK6d+Eyid4At3e4zbysrhL/KrB17apaSlD++b0GA7+foZagZT08to
fUyM5yJIJd7ggm1KdMs45fHfH1UXBOurAQ1nNgjQcbIGpAofaAxIXYRx/wARAQAB
tBl0ZXN0aW5nIDx0ZXN0aW5nQHRlc3Rpbmc+iQJOBBMBCgA4FiEEdNhnsBxpIwn9
BYfpZ7538MqhVLUFAl2CzQUCGwMFCwkIBwI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1HFdFhEhEp/XNK+zu
0cckERb3cHr81LbyiH5LJXZOR9CIoHCemTD5SkczRnYgNGQvzw==
=Q5Ng
-----END PGP PUBLIC KEY BLOCK-----

- Edit key , show key preferences , add subkeys etc.


└──╼ $

Code: Select all

gpg --edit-key testing
gpg (GnuPG) 2.2.17; Copyright (C) 2019 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

sec rsa4096/67BE77F0CAA154B5
created: 2019-09-19 expires: never usage: SC
trust: ultimate validity: ultimate
ssb rsa4096/89AF2749B56D6C05
created: 2019-09-19 expires: never usage: E
[ultimate] (1). testing <testing@testing>

gpg> showpref
[ultimate] (1). testing <testing@testing>
Cipher: AES256, AES192, AES, 3DES
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, Keyserver no-modify

- Åpne GPA , som er en Graphical User Interface for å generere gpg nøkler , kryptere / dekryptere PGP meldinger , kryptere filer , signere PGP meldinger osv. alt du trenger


Image

- Etter du har laget keypairet ovenfor kan du gå i GPA > Keys > Refresh og du vil få det nylige genererte nøkkelparet


Image

- Her er ett eksempel hvordan du signerer en vanlig tekst/melding med din privatekey. Åpne Clipboard i GPA og skriv inn ønsket tekst og trykk på Sign Buffer Text

Image

- Deretter velger du å signere med din egen nøkkel

Image

- Resultatet ser slik ut

Image

- Her er ett eksempel på hvordan du krypterer tekst med en public key til en PGP message. Åpne Clipboard igjen å skriv inn ønsket tekst eller copy/paste tekst du ønsker å kryptere til noen med dere public key og trykk på Encrypt the buffer text.


Image

- Siden jeg under guiden laget mitt eget keypair med private key og public key velger jeg å demonstrere med å bruke min egen public key


Image

- Voila der var teksten kryptert til PGP og du kan copy/paste den til den du har valgt å kryptere med sin public key og dem kan dekryptere meldingen sin med sin private key.

Image


1. Skal du eksportere public keyen din , lagre den som .asc format - Eksempel minpublickey.asc
2. I GPA kan du importere andre sine public keys ved å gå på Keys > Import keys > og finn den aktuelle nøkkelen (i .asc forma)
3. Ellers kan du utforske å GPA og funksjonene der , du kan også generere keypairs der , men GPA tillatter default bare generering av Rsa3072

Post Reply