|
|
|
@ -16,6 +16,9 @@ log = logging.getLogger(__name__)
|
|
|
|
|
def run_create(args):
|
|
|
|
|
"""Generate a new pubkey for a new/existing GPG identity."""
|
|
|
|
|
user_id = os.environ['TREZOR_GPG_USER_ID']
|
|
|
|
|
log.warning('NOTE: in order to re-generate the exact same GPG key later, '
|
|
|
|
|
'run this command with "--time=%d" commandline flag (to set '
|
|
|
|
|
'the timestamp of the GPG key manually).', args.time)
|
|
|
|
|
conn = encode.HardwareSigner(user_id=user_id,
|
|
|
|
|
curve_name=args.ecdsa_curve)
|
|
|
|
|
verifying_key = conn.pubkey(ecdh=False)
|
|
|
|
@ -57,9 +60,9 @@ def run_create(args):
|
|
|
|
|
sys.stdout.write(protocol.armor(result, 'PUBLIC KEY BLOCK'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_agent(args):
|
|
|
|
|
def run_agent(args): # pylint: disable=unused-argument
|
|
|
|
|
"""Run a simple GPG-agent server."""
|
|
|
|
|
sock_path = os.path.expanduser(args.sock_path)
|
|
|
|
|
sock_path = keyring.get_agent_sock_path()
|
|
|
|
|
with server.unix_domain_socket_server(sock_path) as sock:
|
|
|
|
|
for conn in agent.yield_connections(sock):
|
|
|
|
|
with contextlib.closing(conn):
|
|
|
|
@ -81,7 +84,6 @@ def main():
|
|
|
|
|
create_cmd.set_defaults(run=run_create)
|
|
|
|
|
|
|
|
|
|
agent_cmd = subparsers.add_parser('agent')
|
|
|
|
|
agent_cmd.add_argument('-s', '--sock-path', default='~/.gnupg/S.gpg-agent')
|
|
|
|
|
agent_cmd.set_defaults(run=run_agent)
|
|
|
|
|
|
|
|
|
|
args = p.parse_args()
|
|
|
|
|