Re: How to reset a smartcard ?

2009-09-25 Thread tux . tsndcb
Hi Werner,

Your help is a pleasure, thanks you very much, it works fine.

Best Regars.

- Mail Original -
De: "Werner Koch" 
À: "tux tsndcb" 
Cc: gnupg-users@gnupg.org
Envoyé: Vendredi 25 Septembre 2009 11h48:36 GMT +01:00 Amsterdam / Berlin / 
Berne / Rome / Stockholm / Vienne
Objet: Re: How to reset a smartcard ?

On Fri, 25 Sep 2009 10:33, tux.tsn...@free.fr said:

> No body has an idea to "reset" a smartcard as factory settings ? I think it 
> is possible, but I don't know how to do that.

If you have a version 2 card, this is possible.

WARNING: Don't run the commands given below on version 1 cards - you
will brick the card.

1. First you have to lock the PIN by decremeting the retry counters.  I
   do it this way:

  $ gpg-connect-agent --hex
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 83  i.   
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 83  i.   


The status code 6983 says that the PIN is locked.  I use a PIN of
"" which is very likey invalid.

2. You terminate the card and activate it again:

  >  scd apdu 00 e6 00 00
  D[]  90 00  ..  
  OK
  >  scd apdu 00 44 00 00
  D[]  90 00  ..  
  OK
  > bye
  OK closing connection
  >   

Remove the card and insert it again.  That's all.  gpg --card-status
shows a fresh card. 

To make things easier you may send the lines below as input to
gpg-connect-agent (store them in a file and run "gpg-connect-agent < FILE").

==
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 e6 00 00
scd apdu 00 44 00 00
/echo card has been reset to factory defaults
=

gpg-connect-agent has a complete scripting language, you may use it to
write a more robust script with error checking etc.


Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Auschnahme regelt ein Bundeschgesetz.


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: How to reset a smartcard ?

2009-09-25 Thread Werner Koch
On Fri, 25 Sep 2009 10:33, tux.tsn...@free.fr said:

> No body has an idea to "reset" a smartcard as factory settings ? I think it 
> is possible, but I don't know how to do that.

If you have a version 2 card, this is possible.

WARNING: Don't run the commands given below on version 1 cards - you
will brick the card.

1. First you have to lock the PIN by decremeting the retry counters.  I
   do it this way:

  $ gpg-connect-agent --hex
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
  D[]  69 83  i.   
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 82  i.  
  OK
  > scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
  D[]  69 83  i.   


The status code 6983 says that the PIN is locked.  I use a PIN of
"" which is very likey invalid.

2. You terminate the card and activate it again:

  >  scd apdu 00 e6 00 00
  D[]  90 00  ..  
  OK
  >  scd apdu 00 44 00 00
  D[]  90 00  ..  
  OK
  > bye
  OK closing connection
  >   

Remove the card and insert it again.  That's all.  gpg --card-status
shows a fresh card. 

To make things easier you may send the lines below as input to
gpg-connect-agent (store them in a file and run "gpg-connect-agent < FILE").

==
/hex
scd serialno
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
scd apdu 00 e6 00 00
scd apdu 00 44 00 00
/echo card has been reset to factory defaults
=

gpg-connect-agent has a complete scripting language, you may use it to
write a more robust script with error checking etc.


Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Auschnahme regelt ein Bundeschgesetz.


___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


How to reset a smartcard ?

2009-09-25 Thread tux . tsndcb
Hi all,

No body has an idea to "reset" a smartcard as factory settings ? I think it is 
possible, but I don't know how to do that.

Thanks in advanced for your help.

Best Regard


- Mail Original -
De: "tux tsndcb" 
À: gnupg-users@gnupg.org
Envoyé: Dimanche 20 Septembre 2009 08h51:52 GMT +01:00 Amsterdam / Berlin / 
Berne / Rome / Stockholm / Vienne
Objet: How to reset a smartcard ?

Hi,

I wanted to hown how to "reset" a smartcard as factory settings or how to 
blanck all informations on the smartcard (Signature key, Encrpytion key, 
Authentication key ... to none) as on the first use.

Thanks in advanced for your help.

Best Regards

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


How to reset a smartcard ?

2009-09-19 Thread tux . tsndcb
Hi,

I wanted to hown how to "reset" a smartcard as factory settings or how to 
blanck all informations on the smartcard (Signature key, Encrpytion key, 
Authentication key ... to none) as on the first use.

Thanks in advanced for your help.

Best Regards

___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users