Change key-server URL on GnuPG smart card

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

I just setup my new Linux development environment. Try to import my GnuPG keys, and failed due the keyserver didn’t exist anymore. This post demonstrates how to change the keyserver and fetch your public key from it.

First of all open the smart card for edit.

tan@pavilion:~$ gpg --card-edit
Application ID ...: D2760001240102000005000013380000
Version ..........: 2.0
Manufacturer .....: ZeitControl
Serial number ....: 00001338
Name of cardholder: Tan-Vinh Nguyen
Language prefs ...: de
Sex ..............: male
URL of public key : x-hkp://keys.gnupg.net
Login data .......: [not set]
Signature PIN ....: forced
Key attributes ...: 2048R 1024R 2048R
Max. PIN lengths .: 32 32 32
PIN retry counter : 3 3 3
Signature counter : 12
Signature key ....: 194E 8306 8A0B E98E F652  A26E 4ABB 594B 5E39 6988
      created ....: 2012-03-30 21:36:12
Encryption key....: 2C12 F108 5410 0F9E F8C1  091E 8E72 9373 E29C F3C9
      created ....: 2012-03-30 21:36:55
Authentication key: 1CD7 2E69 425C 29A0 C963  EEEF E337 6331 F981 E710
      created ....: 2012-03-30 21:36:55
General key info..: [none]

Using the command prompt with fetch (key), complains no valid OpenPGP data was found.

gpg/card> fetch
gpg: requesting key 5E396988 from hkp server keys.gnupg.net
gpgkeys: key 194E83068A0BE98EF652A26E4ABB594B5E396988 can't be retrieved
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0

Now we are going to change the key server. Therefore we need to enable the admin commands and change the keyserver. We need to confirm the change with the admin code (usually 8 digits long).

gpg/card> url
URL to retrieve public key: x-hkp://pgp.mit.edu

Now we can fetch it and we can leave the gpg command prompt.

gpg/card> fetch
gpg: requesting key 5E396988 from hkp server pgp.mit.edu
gpg: key 5E396988: public key "xxx" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
gpg/card> quit
Please remember the terms for blog comments.