mirror of
https://github.com/romanz/amodem.git
synced 2026-05-09 13:07:39 +08:00
gpg: fix identity stringification
This commit is contained in:
@@ -89,7 +89,7 @@ class Trezor(interface.Device):
|
|||||||
"""Return public key."""
|
"""Return public key."""
|
||||||
curve_name = identity.get_curve_name(ecdh=ecdh)
|
curve_name = identity.get_curve_name(ecdh=ecdh)
|
||||||
log.debug('"%s" getting public key (%s) from %s',
|
log.debug('"%s" getting public key (%s) from %s',
|
||||||
identity, curve_name, self)
|
identity.to_string(), curve_name, self)
|
||||||
addr = identity.get_bip32_address(ecdh=ecdh)
|
addr = identity.get_bip32_address(ecdh=ecdh)
|
||||||
result = self.conn.get_public_node(n=addr,
|
result = self.conn.get_public_node(n=addr,
|
||||||
ecdsa_curve_name=curve_name)
|
ecdsa_curve_name=curve_name)
|
||||||
@@ -106,7 +106,7 @@ class Trezor(interface.Device):
|
|||||||
"""Sign given blob and return the signature (as bytes)."""
|
"""Sign given blob and return the signature (as bytes)."""
|
||||||
curve_name = identity.get_curve_name(ecdh=False)
|
curve_name = identity.get_curve_name(ecdh=False)
|
||||||
log.debug('"%s" signing %r (%s) on %s',
|
log.debug('"%s" signing %r (%s) on %s',
|
||||||
identity, blob, curve_name, self)
|
identity.to_string(), blob, curve_name, self)
|
||||||
try:
|
try:
|
||||||
result = self.conn.sign_identity(
|
result = self.conn.sign_identity(
|
||||||
identity=self._identity_proto(identity),
|
identity=self._identity_proto(identity),
|
||||||
@@ -126,7 +126,7 @@ class Trezor(interface.Device):
|
|||||||
"""Get shared session key using Elliptic Curve Diffie-Hellman."""
|
"""Get shared session key using Elliptic Curve Diffie-Hellman."""
|
||||||
curve_name = identity.get_curve_name(ecdh=True)
|
curve_name = identity.get_curve_name(ecdh=True)
|
||||||
log.debug('"%s" shared session key (%s) for %r from %s',
|
log.debug('"%s" shared session key (%s) for %r from %s',
|
||||||
identity, curve_name, pubkey, self)
|
identity.to_string(), curve_name, pubkey, self)
|
||||||
try:
|
try:
|
||||||
result = self.conn.get_ecdh_session_key(
|
result = self.conn.get_ecdh_session_key(
|
||||||
identity=self._identity_proto(identity),
|
identity=self._identity_proto(identity),
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class Client(object):
|
|||||||
def sign(self, identity, digest):
|
def sign(self, identity, digest):
|
||||||
"""Sign the digest and return a serialized signature."""
|
"""Sign the digest and return a serialized signature."""
|
||||||
log.info('please confirm GPG signature on %s for "%s"...',
|
log.info('please confirm GPG signature on %s for "%s"...',
|
||||||
self.device, identity)
|
self.device, identity.to_string())
|
||||||
if identity.curve_name == formats.CURVE_NIST256:
|
if identity.curve_name == formats.CURVE_NIST256:
|
||||||
digest = digest[:32] # sign the first 256 bits
|
digest = digest[:32] # sign the first 256 bits
|
||||||
log.debug('signing digest: %s', util.hexlify(digest))
|
log.debug('signing digest: %s', util.hexlify(digest))
|
||||||
@@ -43,6 +43,6 @@ class Client(object):
|
|||||||
def ecdh(self, identity, pubkey):
|
def ecdh(self, identity, pubkey):
|
||||||
"""Derive shared secret using ECDH from remote public key."""
|
"""Derive shared secret using ECDH from remote public key."""
|
||||||
log.info('please confirm GPG decryption on %s for "%s"...',
|
log.info('please confirm GPG decryption on %s for "%s"...',
|
||||||
self.device, identity)
|
self.device, identity.to_string())
|
||||||
with self.device:
|
with self.device:
|
||||||
return self.device.ecdh(pubkey=pubkey, identity=identity)
|
return self.device.ecdh(pubkey=pubkey, identity=identity)
|
||||||
|
|||||||
Reference in New Issue
Block a user