gpg: allow symmetric encryption with a passphrase

This commit is contained in:
Roman Zeyde
2018-04-25 11:09:58 +03:00
parent ccc2174775
commit bea899d1ef
3 changed files with 26 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ class UI(object):
self.options_getter = create_default_options_getter()
self.device_name = device_type.__name__
def get_pin(self):
def get_pin(self, name=None):
"""Ask the user for (scrambled) PIN."""
description = (
'Use the numeric keypad to describe number positions.\n'
@@ -33,16 +33,16 @@ class UI(object):
' 4 5 6\n'
' 1 2 3')
return interact(
title='{} PIN'.format(self.device_name),
title='{} PIN'.format(name or self.device_name),
prompt='PIN:',
description=description,
binary=self.pin_entry_binary,
options=self.options_getter())
def get_passphrase(self):
def get_passphrase(self, name=None):
"""Ask the user for passphrase."""
return interact(
title='{} passphrase'.format(self.device_name),
title='{} passphrase'.format(name or self.device_name),
prompt='Passphrase:',
description=None,
binary=self.passphrase_entry_binary,