gpg: rename agent -> keyring

This commit is contained in:
Roman Zeyde
2016-05-21 20:17:58 +03:00
parent 171a0c2f6a
commit db6903eab7
2 changed files with 7 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
import logging
import time
from . import agent, decode, proto
from . import decode, keyring, proto
from .. import client, factory, formats, util
log = logging.getLogger(__name__)
@@ -52,13 +52,13 @@ class AgentSigner(object):
def __init__(self, user_id):
"""Connect to the agent and retrieve required public key."""
self.sock = agent.connect()
self.keygrip = agent.get_keygrip(user_id)
self.sock = keyring.connect_to_agent()
self.keygrip = keyring.get_keygrip(user_id)
def sign(self, digest):
"""Sign the digest and return an ECDSA signature."""
params = agent.sign(sock=self.sock,
keygrip=self.keygrip, digest=digest)
params = keyring.sign_digest(sock=self.sock,
keygrip=self.keygrip, digest=digest)
return b''.join(proto.mpi(p) for p in params)
def close(self):

View File

@@ -15,7 +15,7 @@ from .. import util
log = logging.getLogger(__name__)
def connect(sock_path='~/.gnupg/S.gpg-agent'):
def connect_to_agent(sock_path='~/.gnupg/S.gpg-agent'):
"""Connect to GPG agent's UNIX socket."""
sock_path = os.path.expanduser(sock_path)
sp.check_call(['gpg-connect-agent', '/bye'])
@@ -102,7 +102,7 @@ def _parse_sig(sig):
return parser(args=sig[1:])
def sign(sock, keygrip, digest):
def sign_digest(sock, keygrip, digest):
"""Sign a digest using specified key using GPG agent."""
hash_algo = 8 # SHA256
assert len(digest) == 32