Fix calls to virtualsmartcard.CryptoUtils.append_padding
The interface to append_padding changed some time ago but not all calls have been adapted yet.
This commit is contained in:
@@ -224,7 +224,8 @@ class SAM(object):
|
|||||||
else:
|
else:
|
||||||
cipher = get_referenced_cipher(p1)
|
cipher = get_referenced_cipher(p1)
|
||||||
|
|
||||||
reference = vsCrypto.append_padding(cipher, self.last_challenge)
|
blocklen = vsCrypto.get_cipher_blocklen(cipher)
|
||||||
|
reference = vsCrypto.append_padding(blocklen, self.last_challenge)
|
||||||
reference = vsCrypto.encrypt(cipher, key, reference)
|
reference = vsCrypto.encrypt(cipher, key, reference)
|
||||||
if(reference == data):
|
if(reference == data):
|
||||||
#Invalidate last challenge
|
#Invalidate last challenge
|
||||||
@@ -371,7 +372,8 @@ if __name__ == "__main__":
|
|||||||
print("Counter = " + str(MyCard.counter))
|
print("Counter = " + str(MyCard.counter))
|
||||||
sw, challenge = MyCard.get_challenge(0x00, 0x00, "")
|
sw, challenge = MyCard.get_challenge(0x00, 0x00, "")
|
||||||
print("Before encryption: " + challenge)
|
print("Before encryption: " + challenge)
|
||||||
padded = vsCrypto.append_padding("DES3-ECB", challenge)
|
blocklen = vsCrypto.get_cipher_blocklen("DES3-ECB")
|
||||||
|
padded = vsCrypto.append_padding(blocklen, challenge)
|
||||||
sw, result_data = MyCard.internal_authenticate(0x00, 0x00, padded)
|
sw, result_data = MyCard.internal_authenticate(0x00, 0x00, padded)
|
||||||
print("Internal Authenticate status code: %x" % sw)
|
print("Internal Authenticate status code: %x" % sw)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user