Skip to content

Commit cef582d

Browse files
onlykeyonlykey
authored andcommitted
Change packet format
1 parent 2f5aebd commit cef582d

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

onlykey/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,7 @@ def send_large_message3(self, payload=None, msg=None, slot_id=101, key_type=1):
239239
for chunk in chunks:
240240
# print chunk
241241
# print [ord(c) for c in chunk]
242-
current_payload = [slot_id, key_type, 255] # 255 means that it's not the last payload
243-
# If it's less than the max size, set explicitely the size
244-
if len(chunk) < 56:
245-
current_payload = [slot_id, key_type, len(chunk)]
242+
current_payload = [slot_id, key_type]
246243

247244
# Append the actual payload
248245
if isinstance(chunk, list):

tests/ssh_auth_rsa_1024.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def pack_long(n):
7575
# send the byte array to OnlyKey splitting into 56 bytes per packet
7676
q_and_p = pack_long(q) + pack_long(p)
7777
#
78-
ok.send_large_message3(msg=255, slot_id=1, key_type=64+1, payload=q_and_p)
78+
ok.send_large_message3(msg=Message.OKSETPRIV, slot_id=1, key_type=64+1, payload=q_and_p)
7979

8080
# ok.set_rsa_key(1, (1+64), byte array here) #Can only send 56 bytes per packet
8181
# Slot 1 - 4 for RSA
@@ -98,7 +98,7 @@ def pack_long(n):
9898
time.sleep(1.5)
9999
for _ in xrange(10):
100100
ok_pubkey = ok.read_bytes((1*128), to_str=True)
101-
if len(ok_pubkey) == (rsatype*128):
101+
if len(ok_pubkey) == (1*128):
102102
break
103103
time.sleep(1)
104104

0 commit comments

Comments
 (0)