Omnikey 6121:無法寫入 OpenPGP 智慧卡

Omnikey 6121:無法寫入 OpenPGP 智慧卡

我正在嘗試將 Omnikey 6121 智慧卡讀卡機與 OpenPGPv2 智慧卡結合使用。正如我所見,讀者已被識別,gpg --card-status並且我能夠編輯一些卡片詳細信息,例如 URL、名稱等

但是,當我嘗試發出“keytocard”命令時,我得到以下資訊:

gpg: writing new key
gpg: 3 Admin PIN attempts remaining before card is permanently locked

Please enter the Admin PIN
gpg: ccid_transceive failed: (0x10002)
gpg: apdu_send_simple(0) failed: invalid value
gpg: failed to store the key: invalid argument
gpg: error writing key to card: invalid argument

與 --debug-ccid-driver 出現相同的錯誤。

同樣,如果我只是發出“生成”:

gpg/card> generate
Make off-card backup of encryption key? (Y/n) n

Please enter the PIN
What keysize do you want for the Signature key? (2048) 
What keysize do you want for the Encryption key? (2048) 
What keysize do you want for the Authentication key? (2048) 
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) 
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 the Real Name, Comment and E-mail Address in this form:
    "Heinrich Heine (Der Dichter) <[email protected]>"

Real name: Deim0s Anomaly
E-mail address: [email protected]
Comment: 
You selected this USER-ID:
    "Deim0s Anomaly <[email protected]>"

Change (N)ame, (C)omment, (E)-mail or (O)kay/(Q)uit? O
gpg: generating new key
gpg: 3 Admin PIN attempts remaining before card is permanently locked

Please enter the Admin PIN
gpg: please wait while key is being generated ...
gpg: generating key failed
gpg: key generation failed: general error
Key generation failed: general error

gpg/card> 

這是怎麼回事?有人可以幫忙嗎?

答案1

很奇怪,但我終於設法使這個設定起作用(全能6121+OpenGPG v2 卡)。這是如何一個凡人可以達到同樣的效果:

  1. 停用/etc/X11/Xsession.d/ 中的90gpg-agent-mine和 ,90ssh-agent-mine這樣它們就不會嘗試啟動 gpg-agent 或 ssh-agent
  2. 建立一個新的 gpg-agent-wrapper,如中所述https://blog.flameeyes.eu/2010/08/smart-cards-and-secret-agents

在 (1) 中,不從那裡啟動 gpg-agent 的原因是它不會啟用 --enable-ssh-support,這是我想要的。

透過發出gpg --card-status,您現在會注意到一個小的延遲,然後:

gpg: detected reader `OMNIKEY CardMan (076B:6622) 6121 00 00'
Application ID ...: ......

這意味著卡片現在也可以用於寫入操作!耶!我的keytocard成功了:)

相關內容