Skip to content

Instantly share code, notes, and snippets.

@trebortech
Last active February 10, 2018 16:30
Show Gist options
  • Save trebortech/277a00b8d8609c61742307db38bbee76 to your computer and use it in GitHub Desktop.
Save trebortech/277a00b8d8609c61742307db38bbee76 to your computer and use it in GitHub Desktop.
SetPinRetries
# Core lib imports
from binascii import a2b_hex
# Yubico lib imports
from ykman import driver_ccid as CCID
from ykman import piv as PIV
objCCIDDevices = CCID.open_devices()
driverCCID = objCCIDDevices.next()
# Create connection to PIV modules
controllerPIV = PIV.PivController(driverCCID)
print "Serial Number: {0}".format(driverCCID.serial)
# Default YubiKey values
defaultPIN = '123456'
defaultPUK = '12345678'
defaultMGT = '010203040506070801020304050607080102030405060708'
byteMGT = a2b_hex(defaultMGT)
# Verify and authenticate to device
controllerPIV.verify(defaultPIN)
controllerPIV.authenticate(byteMGT)
# The PIN and PUK will be set to default values
pintries = 6
puktries = 6
controllerPIV.set_pin_retries(pintries, puktries)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment