37 |
def get_passphrase(): |
def get_passphrase(): |
38 |
"""Get passphrase from environment or, failing that, from user""" |
"""Get passphrase from environment or, failing that, from user""" |
39 |
try: return os.environ['PASSPHRASE'] |
try: return os.environ['PASSPHRASE'] |
40 |
except KeyError: |
except KeyError: pass |
41 |
if globals.encryption: |
if not globals.encryption: return "" # assume we don't need passphrase |
|
log.Log("PASSPHRASE variable not set, asking user.", 5) |
|
|
return getpass.getpass("GnuPG passphrase: ") |
|
|
else: return "" # assume we don't need passphrase |
|
42 |
|
|
43 |
|
log.Log("PASSPHRASE variable not set, asking user.", 5) |
44 |
|
while 1: |
45 |
|
pass1 = getpass.getpass("GnuPG passphrase: ") |
46 |
|
pass2 = getpass.getpass("Retype to confirm: ") |
47 |
|
if pass1 == pass2: return pass1 |
48 |
|
print "First and second passphrases do not match! Please try again." |
49 |
|
|
50 |
def write_multivol(backup_type, tarblock_iter, backend): |
def write_multivol(backup_type, tarblock_iter, backend): |
51 |
"""Encrypt volumes of tarblock_iter and write to backend |
"""Encrypt volumes of tarblock_iter and write to backend |