31 lines
911 B
Python
31 lines
911 B
Python
import binascii
|
|
|
|
from gpgcard import GPGCard
|
|
|
|
gpgcard = GPGCard()
|
|
gpgcard.connect("pcsc:Ledger")
|
|
gpgcard.get_all()
|
|
|
|
gpgcard.verify_pin(0x81, "123456")
|
|
gpgcard.verify_pin(0x83, "12345678")
|
|
|
|
gpgcard.generate_asym_key_pair(0x80, 0xb600)
|
|
gpgcard.generate_asym_key_pair(0x80, 0xb800)
|
|
gpgcard.generate_asym_key_pair(0x80, 0xa400)
|
|
|
|
# Use 'gpg -k --with-subkey-fingerprint' to find fingerprints
|
|
|
|
sig_fingerprint = b'A3F35A5124D47C3195FF07B7F85D93686A3A9063'
|
|
aut_fingerprint = b'9C686F97A39B4A34E0C9D37CDBF45893AB524BBC'
|
|
dec_fingerprint = b'E4FE54969060DBF2756FC0EFD8203245E390CAEA'
|
|
|
|
sig_fingerprint_bin = binascii.unhexlify(sig_fingerprint)
|
|
aut_fingerprint_bin = binascii.unhexlify(aut_fingerprint)
|
|
dec_fingerprint_bin = binascii.unhexlify(dec_fingerprint)
|
|
|
|
gpgcard.sig_fingerprints = sig_fingerprint_bin
|
|
gpgcard.aut_fingerprints = aut_fingerprint_bin
|
|
gpgcard.dec_fingerprints = dec_fingerprint_bin
|
|
|
|
gpgcard.set_all()
|