mirror of
https://github.com/romanz/amodem.git
synced 2026-03-23 19:01:00 +08:00
Move decompression into device.pubkey()
This commit is contained in:
@@ -20,16 +20,14 @@ class Client:
|
||||
|
||||
def export_public_keys(self, identities):
|
||||
"""Export SSH public keys from the device."""
|
||||
public_keys = []
|
||||
pubkeys = []
|
||||
with self.device:
|
||||
for i in identities:
|
||||
pubkey = self.device.pubkey(identity=i)
|
||||
vk = formats.decompress_pubkey(pubkey=pubkey,
|
||||
curve_name=i.curve_name)
|
||||
public_key = formats.export_public_key(vk=vk,
|
||||
label=i.to_string())
|
||||
public_keys.append(public_key)
|
||||
return public_keys
|
||||
vk = self.device.pubkey(identity=i)
|
||||
label = i.to_string()
|
||||
pubkey = formats.export_public_key(vk=vk, label=label)
|
||||
pubkeys.append(pubkey)
|
||||
return pubkeys
|
||||
|
||||
def sign_ssh_challenge(self, blob, identity):
|
||||
"""Sign given blob using a private key on the device."""
|
||||
|
||||
@@ -22,7 +22,7 @@ class MockDevice(device.interface.Device): # pylint: disable=abstract-method
|
||||
|
||||
def pubkey(self, identity, ecdh=False): # pylint: disable=unused-argument
|
||||
assert self.conn
|
||||
return PUBKEY
|
||||
return formats.decompress_pubkey(pubkey=PUBKEY, curve_name=identity.curve_name)
|
||||
|
||||
def sign(self, identity, blob):
|
||||
"""Sign given blob and return the signature (as bytes)."""
|
||||
|
||||
Reference in New Issue
Block a user