doc:appunti:linux:tux:gpg
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:tux:gpg [2009/09/16 11:21] – niccolo | doc:appunti:linux:tux:gpg [2021/08/29 09:14] (current) – [Creazione della coppia chiavi pubblica/privata] niccolo | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| < | < | ||
| - | gpg --gen-key | + | gpg --full-generate-key |
| </ | </ | ||
| < | < | ||
| - | DSA keypair will have 1024 bits. | + | Please select what kind of key you want: |
| - | ELG-E keys may be between 1024 and 4096 bits long. | + | RSA and RSA |
| + | RSA keys may be between 1024 and 4096 bits long. | ||
| Requested keysize is 2048 bits | Requested keysize is 2048 bits | ||
| - | Key is valid for? (0) 2y | + | Key is valid for? (0) 3y |
| - | Key expires at Fri 13 Jul 2007 02:42:12 PM CEST | + | Real name: Niccolo Rigacci |
| - | You selected this USER-ID: | + | Email address: niccolo@rigacci.org |
| - | " | + | |
| </ | </ | ||
| La chiave privata (protetta dalla passphrase) viene memorizzata in '' | La chiave privata (protetta dalla passphrase) viene memorizzata in '' | ||
| + | |||
| + | Per pubblicare la propria chiave (la parte pubblica) su un server pubblico: | ||
| + | |||
| + | < | ||
| + | gpg --keyserver pgp.key-server.io --send-keys 58F28BB5 | ||
| + | </ | ||
| Questi i comandi per: | Questi i comandi per: | ||
| Line 32: | Line 38: | ||
| gpg --list-secret-keys | gpg --list-secret-keys | ||
| </ | </ | ||
| + | |||
| + | ===== Pubblicazione su keys.openpgp.org ===== | ||
| + | |||
| + | Sul server **[[https:// | ||
| + | |||
| ===== Firmare o criptare un documento ===== | ===== Firmare o criptare un documento ===== | ||
| Line 101: | Line 112: | ||
| Importante lo switch **'' | Importante lo switch **'' | ||
| - | Esistono dei server pubblici dedicati allo scambio delle chiavi (pubbliche). Ad esempio con **[[http://wwwkeys.eu.pgp.net/|wwwkeys.eu.pgp.net]]** oppure **[[http://keyserver.veridis.com:11371/|keyserver.veridis.com]]** l' | + | Esistono dei server pubblici dedicati allo scambio delle chiavi (pubbliche). Ad esempio con **[[http://pgp.key-server.io/|pgp.key-server.io]]** oppure **[[https://pgp.mit.edu/|pgp.mit.edu]]** l' |
| Per installare nel proprio portachiavi una chiave presa dal server in questione si può prelevare il file ASCII-armored ed effettuare l''' | Per installare nel proprio portachiavi una chiave presa dal server in questione si può prelevare il file ASCII-armored ed effettuare l''' | ||
| Line 109: | Line 120: | ||
| < | < | ||
| gpg --keyserver minsky.surfnet.nl --recv-keys 111FA57C | gpg --keyserver minsky.surfnet.nl --recv-keys 111FA57C | ||
| + | </ | ||
| + | |||
| + | ===== Copia di una chiave privata ===== | ||
| + | |||
| + | Con questa procedura si può copiare una chiave privata da un host ad un altro. Per prima cosa si elencano le chiavi private e si prende nota dell' | ||
| + | |||
| + | < | ||
| + | gpg --list-secret-keys | ||
| + | </ | ||
| + | |||
| + | Quindi si salva in un file il **PRIVATE KEY BLOCK** (quasi certamente la chiave privata è protetta da password, che viene chiesta durante la procedura di esportazione): | ||
| + | |||
| + | < | ||
| + | touch private.key | ||
| + | chmod 640 private.key | ||
| + | gpg --armor --export-secret-keys 8364FCC486877E37A39B7D5D01526646275E281D > private.key | ||
| + | </ | ||
| + | |||
| + | Dopo aver copiato il file sul nuovo host, si esegue (viene chiesta nuovamente la password che protegge la chiave): | ||
| + | |||
| + | < | ||
| + | gpg --import private.key | ||
| + | </ | ||
| + | |||
| + | La chiave privata viene salvata nel keyring, si può verificare con **%%gpg --list-secret-keys%%**. La chiave resta **cifrata** con la password che aveva in origine. | ||
| + | ===== Cifrare/ | ||
| + | |||
| + | < | ||
| + | gpg --encrypt < | ||
| + | gpg --decrypt < | ||
| + | </ | ||
| + | |||
| + | Vengono chiesti gli ID dei destinatari. Per ogni destinatario aggiunto il file cresce di pochi byte. | ||
| + | |||
| + | Per produrre un file criptato, ma in formato ASCII: | ||
| + | |||
| + | < | ||
| + | gpg --armor --encrypt < | ||
| + | gpg --decrypt < | ||
| </ | </ | ||
| Line 126: | Line 176: | ||
| Il messaggio di warning significa che la chiave è stata ottenuta senza seguire una //trust path// opportuna, infatti è stata direttamente scaricata dal web e messa nel portachiavi. | Il messaggio di warning significa che la chiave è stata ottenuta senza seguire una //trust path// opportuna, infatti è stata direttamente scaricata dal web e messa nel portachiavi. | ||
| + | |||
| + | ===== Firmare una chiave ===== | ||
| + | |||
| + | Firmare la chiave di qualcuno (**[[http:// | ||
| + | |||
| + | < | ||
| + | gpg --sign-key < | ||
| + | gpg --keyserver < | ||
| + | </ | ||
| + | |||
| + | Durante i Keysigning Party si prende nota della //key ID// e della //public key fingerprint// | ||
| + | |||
| + | Con altri mezzi si recupera l' | ||
| + | |||
| + | < | ||
| + | gpg --with-fingerprint < | ||
| + | gpg -i --import < | ||
| + | </ | ||
| + | |||
| + | |||
| + | Per vedere la fingerprint delle chiavi in nostro possesso: | ||
| + | |||
| + | < | ||
| + | gpg --fingerprint | ||
| + | </ | ||
| + | |||
| + | ===== Ricerca di una chiave pubblica ===== | ||
| + | |||
| + | Si dovrebbe poter interrogare dei server pubblici per cercare la chiave pubblica di una persona, ad esempio **[[http:// | ||
| + | |||
| + | {{pgp.key-server.io.png? | ||
| + | |||
| + | Nella schermata sopra si vede ad esempio che esiste la chiave **275E281D** scaduta il **2018-09-17**, | ||
doc/appunti/linux/tux/gpg.1253092898.txt.gz · Last modified: by niccolo
