User Tools

Site Tools


informatica:linux:claves_gpg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:linux:claves_gpg [2013/03/13 15:26] javiinformatica:linux:claves_gpg [2023/11/30 14:04] (current) jose
Line 5: Line 5:
 Para operar con las claves, instalar gunpg: Para operar con las claves, instalar gunpg:
  
-  aptitude install gnupg+  sudo aptitude install gnupg
  
  
Line 216: Line 216:
  
  
 +==== Revocar Clave del Servidor ====
 +Si una clave vamos a dejar de usarla, hay que revocarla.
  
 +Para revocarla, tenemos que crear un certificado de revocación y luego subirlo al servidor. Para crear el certificado de revocación, necesitamos la clave privada. Es aconsejable crear siempre el certificado de revocación.
 +
 +Vamos a revocar la antigua clave de 1024DSA porque hemos generado una nueva de 4096RSA
 +
 +<code>
 +# gpg --list-keys
 +
 +-----------------------------
 +pub   4096R/F4AD9A55 2014-09-15
 +uid                  Jose Legido <jose@legido.com>
 +sub   4096R/BAB57DE6 2014-09-15
 +
 +pub   1024D/5A988F96 2008-03-20
 +uid                  Jose Legido <jose@legido.com>
 +sub   2048g/9BC56CC9 2008-03-20
 +
 +</code>
 +<code>
 +# gpg --output revoke1024.asc --gen-revoke 5A988F96
 +
 +sec  1024D/5A988F96 2008-03-20 Jose Legido <jose@legido.com>
 +Create a revocation certificate for this key? (y/N) y
 +Please select the reason for the revocation:
 +  0 = No reason specified
 +  1 = Key has been compromised
 +  2 = Key is superseded
 +  3 = Key is no longer used
 +  Q = Cancel
 +(Probably you want to select 1 here)
 +Your decision? 3
 +Enter an optional description; end it with an empty line:
 +> New Key F4AD9A55
 +>
 +Reason for revocation: Key is no longer used
 +New Key F4AD9A55
 +Is this okay? (y/N) y
 +
 +You need a passphrase to unlock the secret key for
 +user: "Jose Legido <jose@legido.com>"
 +1024-bit DSA key, ID 5A988F96, created 2008-03-20
 +
 +ASCII armored output forced.
 +Revocation certificate created.
 +
 +Please move it to a medium which you can hide away; if Mallory gets
 +access to this certificate he can use it to make your key unusable.
 +It is smart to print this certificate and store it away, just in case
 +your media become unreadable.  But have some caution:  The print system of
 +your machine might store the data and make it available to others!
 +</code>
 +
 +Ahora subimos el certificado de revocación para revocar la clave:
 +<code>
 +# gpg --import revoke1024.asc
 +gpg: key 5A988F96: "Jose Legido <jose@legido.com>" revocation certificate imported
 +gpg: Total number processed: 1
 +gpg:    new key revocations: 1
 +gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
 +gpg: depth: 0  valid:    signed:    trust: 0-, 0q, 0n, 0m, 0f, 1u
 +</code>
 +
 +Al cabo de un rato, la clave aparece como revocada:
 +<code>
 +# gpg --search-keys jose@legido.com
 +gpg: searching for "jose@legido.com" from hkp server keys.gnupg.net
 +(1) Jose Legido <jose@legido.com>
 +   4096 bit RSA key F4AD9A55, created: 2014-09-15
 +(2) Jose Legido <jose@legido.com>
 +   1024 bit DSA key 5A988F96, created: 2008-03-20 (revoked)
 +
 +</code>
  
 ==== Descargar claves a servidor de claves ==== ==== Descargar claves a servidor de claves ====
Line 267: Line 340:
   gpg: keyserver search failed: keyserver error   gpg: keyserver search failed: keyserver error
  
-Indicando otro servidor funciona, pero a veces también falla: +Indicando otro servidor funciona, pero a veces también falla
-  # gpg   --keyserver subkeys.pgp.net --search-keys 5A988F96+  Servidores: 
 +  keyserver.ubuntu.com 
 +  subkeys.pgp.net 
 +  pgp.mit.edu 
 + 
 +  # gpg   --keyserver keyserver.ubuntu.com --search-keys 5A988F96
   gpg: searching for "5A988F96" from hkp server subkeys.pgp.net   gpg: searching for "5A988F96" from hkp server subkeys.pgp.net
      
Line 403: Line 481:
  
 Teclear 'y' y pulsar 'enter' Teclear 'y' y pulsar 'enter'
 +
  
  
Line 427: Line 506:
   # gpg --output desencriptado.txt --decrypt encriptado.txt   # gpg --output desencriptado.txt --decrypt encriptado.txt
  
 +==== Encriptar Fichero ====
  
 +1. Listar las claves instaladas para tenerlas a mano
  
 +  gpg --list-keys
 +
 +2. Encriptar el archivo:
 +
 +  gpg --encrypt archivo.txt
 +
 +3. Introducir el identificador de la clave y pulsar 'enter'
 +
 +4. Teclear 'y' y pulsar 'enter'
 +
 +Se habra generado el archivo 'archivo.txt.gpg' que solo podra desencriptar la persona con la clave privada asociada a la clave publica (paso 3) contra la que se ha encriptado el archivo.
 +
 +1
  
 ==== Programas adicionales ==== ==== Programas adicionales ====
Line 494: Line 588:
  
   gpg --list-keys   gpg --list-keys
 +
 +
 +==== Exportar / importar clave privada ====
 +
 +**OJO** la clave privada no debe ser accesible por nadie más que su propietario
 +
 +* Exportar
 +
 +  gpg --export-secret-key -a > clave_privada.key
 +
 +* Importar
 +
 +  gpg --import clave_privada.key
  
 ==== Otros ==== ==== Otros ====
informatica/linux/claves_gpg.1363188416.txt.gz · Last modified: 2015/04/13 20:19 (external edit)