smartpgp-cli: set KDF-DO
This commit is contained in:
parent
c60c4d7c32
commit
e720a23417
@ -46,6 +46,7 @@ VALID_COMMANDS={
|
|||||||
'put-aes-key': CardConnectionContext.cmd_put_aes_key,
|
'put-aes-key': CardConnectionContext.cmd_put_aes_key,
|
||||||
'encrypt-aes': CardConnectionContext.cmd_encrypt_aes,
|
'encrypt-aes': CardConnectionContext.cmd_encrypt_aes,
|
||||||
'decrypt-aes': CardConnectionContext.cmd_decrypt_aes,
|
'decrypt-aes': CardConnectionContext.cmd_decrypt_aes,
|
||||||
|
'set-kdf': CardConnectionContext.cmd_set_kdf,
|
||||||
}
|
}
|
||||||
|
|
||||||
def read_pin_interactive(name):
|
def read_pin_interactive(name):
|
||||||
|
@ -341,3 +341,10 @@ def decrypt_aes(connection, msg):
|
|||||||
(nres,sw1,sw2) = _raw_send_apdu(connection,"Receiving decrypted chunk",apdu)
|
(nres,sw1,sw2) = _raw_send_apdu(connection,"Receiving decrypted chunk",apdu)
|
||||||
res = res + nres
|
res = res + nres
|
||||||
return (res,sw1,sw2)
|
return (res,sw1,sw2)
|
||||||
|
|
||||||
|
|
||||||
|
def put_kdf_do(connection, kdf_do):
|
||||||
|
prefix = [0x00, 0xDA, 0x00, 0xF9]
|
||||||
|
data = kdf_do
|
||||||
|
apdu = assemble_with_len(prefix, data)
|
||||||
|
_raw_send_apdu(connection,"Put KDF-DO",apdu)
|
||||||
|
@ -297,3 +297,15 @@ class CardConnectionContext:
|
|||||||
f.write(data)
|
f.write(data)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
def cmd_set_kdf(self):
|
||||||
|
if self.input is None:
|
||||||
|
print "No input KDF-DO"
|
||||||
|
return
|
||||||
|
f = open(self.input, 'r')
|
||||||
|
kdf_do = f.read()
|
||||||
|
kdf_do = [ord(c) for c in kdf_do]
|
||||||
|
f.close()
|
||||||
|
self.connect()
|
||||||
|
self.verify_admin_pin()
|
||||||
|
put_kdf_do(self.connection, kdf_do)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user