GPG en Solaris

Page last edited hace 2208 días 8 horas
De Solaris-ES
Saltar a: navegación, buscar
  • Crea el directorio de trabajo
bash-2.03$ mkdir /export/home/mobarrio/.gnupg
bash-2.03$ chmod 700 /export/home/mobarrio/.gnupg
  • Generar la clave DSA o RSA
bash-2.03$ gpg --gen-key
Please select what kind of key you want:
   (1) DSA and ElGamal (default)
   (2) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
About to generate a new ELG-E keypair.
              minimum keysize is  768 bits
              default keysize is 1024 bits
    highest suggested keysize is 2048 bits
What keysize do you want? (1024) ENTER
Requested keysize is 1024 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) ENTER
Key does not expire at all
Is this correct (y/n)? y
You need a User-ID to identify your key; the software constructs the user id
from Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name: Mariano J. Obarrio Miles
Email address: mariano.obarrio@gmail.com
Comment: Prueba de claves en GPG
You selected this USER-ID:      
    "Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.    
You don't want a passphrase - this is probably a *bad* idea!
I will do it anyway.  You can change your passphrase at any time,
using this program with the option "--edit-key".
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.
+++++.+++++++++++++++++++++++++++++++++++.+++++++++++++++.+++++++++++++++++++++++++..+++++++++++++++.+++++++++++++++ 
++++++++++.+++++.+++++.................>+++++................+++++^^^^
public and secret key created and signed.
key marked as ultimately trusted.
pub  1024D/1677E7E7 2007-07-25 Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>
     Key fingerprint = 5C8F 6781 E45A 4770 DE0B  4C8C BF31 B1E4 1677 E7E7
sub  1024g/4221BCE5 2007-07-25


  • Listar las firmas disponibles
bash-2.03$ gpg --list-sigs
/export/home/mobarrio/.gnupg/pubring.gpg
----------------------------------------
pub  1024D/DD0E6797 2005-09-30 Mariano Obarrio <mariano.obarrio@gmail.com>
sig 3       DD0E6797 2005-09-30   Mariano Obarrio <mariano.obarrio@gmail.com>
sub  1024g/DC63A582 2005-09-30
sig         DD0E6797 2005-09-30   Mariano Obarrio <mariano.obarrio@gmail.com>
pub  1024D/1677E7E7 2007-07-25 Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>
sig 3       1677E7E7 2007-07-25   Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>
sub  1024g/4221BCE5 2007-07-25
sig         1677E7E7 2007-07-25   Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>


bash-2.03$ gpg --fingerprint "Mariano J. Obarrio Miles (Prueba de claves en GPG)"
pub  1024D/1677E7E7 2007-07-25 Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>
     Key fingerprint = 5C8F 6781 E45A 4770 DE0B  4C8C BF31 B1E4 1677 E7E7
sub  1024g/4221BCE5 2007-07-25
  • Listar las claves publicas
bash-2.03$ gpg --list-public-keys
/export/home/mobarrio/.gnupg/pubring.gpg
----------------------------------------
pub  1024D/DD0E6797 2005-09-30 Mariano Obarrio <mariano.obarrio@gmail.com>
sub  1024g/DC63A582 2005-09-30
  • Listar las claves privadas
bash-2.03$ gpg --list-secret-keys
/export/home/mobarrio/.gnupg/secring.gpg
----------------------------------------
sec  1024D/DD0E6797 2005-09-30 Mariano Obarrio <mariano.obarrio@gmail.com>
ssb  1024g/DC63A582 2005-09-30
  • Exportar la clave a formato ASC
bash-2.03$ gpg --export -a "Mariano J. Obarrio Miles (Prueba de claves en GPG)" >Mariano.pub.asc
  • Importar una clave generada en formato ASC
bash-2.03$ gpg --import -a Mariano.pub.asc
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information
gpg: key DD0E6797: public key "Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>"  
imported
gpg: Total number processed: 1
gpg:               imported: 1


Encripción y Desencripción[editar]

-e, --encrypt                  encrypt data
    --encrypt-files [files]    encrypt files

-a, --armor                    create ascii armored output
-u, --local-user               use this user-id to sign or decrypt

-d, --decrypt                  decrypt data (default)
    --decrypt-files [files]    decrypt files

-r, --recipient NAME           encrypt for NAME
    --default-recipient NAME   use NAME as default recipient
    --default-recipient-self   use the default key as default recipient
  • Encriptar un archivo
bash-2.03$ gpg -a -er "Mariano J. Obarrio Miles (Prueba de claves en GPG)" test.txt
gpg: checking the trustdb
gpg: checking at depth 0 signed=0 ot(-/q/n/m/f/u)=0/0/0/0/0/2
  • Verificar el contenido encriptado
bash-2.03$ more test.txt.asc
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.2.6 (SunOS)

hQEOA2wvAwNCIbzlEAP/bMygjsI5i6ydqesOMwjfqlF5Nvv1IkdqjD2byWt20W1j
g31NiRc58M5rR6ngDZbSR3+31Lvg+Cnh1Kvwng/Y4QOUKyALhSqhvmsB4/Hm0j36
KU5sMB9HCUr7degBlz3yBbnAnJgyL7VN0SxRLVYAL8Xam7PidFVzB8TEWut/vXcD
/3L6ixUo4Yl1CZ1yDGqH+SgDqlfOGVQOZL/YfhDtCU37bKLyt0+mC4+iTzdaOUXQ
NstaK2Gyz/1J8ufLmYKCcS04IyVoDGPcRpEJ6Wr1lzM7rJ8k9Tc9aC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xmfpP
oTt4omnyxybyZGFMv1BwKt3rwnCIKMOm+2RqlyW+MjNTBqVpzoXVZ8tXOu2E+B7H
B7XHhmiVYWcu/ApQ7wy9HhNeAKRDbIkvBf7kdF3oAVsgttsy4TaC0QP9PRHNE85r
hptIMmGsUvpqDOr5feM3tRuqARms5JHm+gPzzy/vlRVAkxABA0Dm6DzxYPjNopJ8
qSuSacTZ+BS5rku5MyVetxPeYoEA2nrUckh9IAyJcVR0Ena7CaOPyke7PnZxacHD
QMcjgMBSV/6fIhkdkFBG52DkZmqL3ZjOmWs8n9fd6sUkR3F7X86hdwr+sbMcRJ88
4X21ydpIH0X/YS7iEKEI8aEN5Ds/Ul4XUzzXN5e+Bknqvad/KrfeZ1hhVkpx74uk
YeEYw69v8ehwQ15UKktjRTBeJmqqVkZfEwb6K2YMM6qN7A7ErX4EXd8yPRG65K+k
G0PKfUsitD6NFe4Gq5tRWBeMtD+e/nKItIvWra+hpnw9ltXkDYvEXjFfE0Bzga+X
KFb3C/tI9gF3YGFki7ZMO0yzudzXXAY5pRxMqmphuOEWqNgWzmpzszvgLkozUX/D
n5+RiQBzb5ZFiig5oteqq3pThX2UmxQJ5MF0L5Lc9DUv+BKYwR0jjA==
=V+GH
-----END PGP MESSAGE-----
  • Desencriptar el archivo con la clave privada
bash-2.03$ gpg -a -dr "Mariano J. Obarrio Miles (Prueba de claves en GPG)" test.txt.asc >test2.txt
gpg: encrypted with 1024-bit ELG-E key, ID 4221BCE5, created 2007-07-25
      "Mariano J. Obarrio Miles (Prueba de claves en GPG) <mariano.obarrio@gmail.com>"

Encripción y Desencripción sin mensajes por pantalla[editar]

gpg -a -er "Mariano J. Obarrio Miles (Prueba de claves en GPG)" test.txt 2>/dev/null
gpg -a -dr "Mariano J. Obarrio Miles (Prueba de claves en GPG)" test.txt.asc 2>/dev/null >testnew.txt