mirror of
https://github.com/romanz/amodem.git
synced 2026-04-01 17:26:49 +08:00
gpg: remove extra param from Factory.from_public_key()
This commit is contained in:
@@ -41,8 +41,7 @@ def pksign(keygrip, digest, algo):
|
||||
assert algo == '8'
|
||||
pubkey = decode.load_public_key(keyring.export_public_key(user_id=None),
|
||||
use_custom=True)
|
||||
f = encode.Factory.from_public_key(pubkey=pubkey,
|
||||
user_id=pubkey['user_id'])
|
||||
f = encode.Factory.from_public_key(pubkey=pubkey)
|
||||
with contextlib.closing(f):
|
||||
assert f.pubkey.keygrip == binascii.unhexlify(keygrip)
|
||||
r, s = f.conn.sign(binascii.unhexlify(digest))
|
||||
@@ -86,8 +85,7 @@ def pkdecrypt(keygrip, conn):
|
||||
local_pubkey = decode.load_public_key(
|
||||
pubkey_bytes=keyring.export_public_key(user_id=None),
|
||||
use_custom=True)
|
||||
f = encode.Factory.from_public_key(
|
||||
pubkey=local_pubkey, user_id=local_pubkey['user_id'])
|
||||
f = encode.Factory.from_public_key(pubkey=local_pubkey)
|
||||
with contextlib.closing(f):
|
||||
assert f.pubkey.keygrip == binascii.unhexlify(keygrip)
|
||||
shared_secret = f.get_shared_secret(remote_pubkey)
|
||||
|
||||
@@ -97,13 +97,12 @@ class Factory(object):
|
||||
self.pubkey, _time_format(self.pubkey.created), user_id)
|
||||
|
||||
@classmethod
|
||||
def from_public_key(cls, pubkey, user_id):
|
||||
def from_public_key(cls, pubkey):
|
||||
"""Create from an existing GPG public key."""
|
||||
is_ecdh = (pubkey['algo'] == proto.ECDH_ALGO_ID)
|
||||
f = cls(user_id=user_id,
|
||||
f = cls(user_id=pubkey['user_id'],
|
||||
created=pubkey['created'],
|
||||
curve_name=proto.find_curve_by_algo_id(pubkey['algo']),
|
||||
ecdh=is_ecdh)
|
||||
ecdh=(pubkey['algo'] == proto.ECDH_ALGO_ID))
|
||||
assert f.pubkey.key_id() == pubkey['key_id']
|
||||
return f
|
||||
|
||||
|
||||
Reference in New Issue
Block a user