From 8921df90d8b01cf3ad8cb093ec8bbaf5e7d89bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 15 Jan 2014 05:34:35 +0100 Subject: [PATCH] qvm-backup: add options to specify custom hmac/enc algorithms --- qvm-tools/qvm-backup | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/qvm-tools/qvm-backup b/qvm-tools/qvm-backup index d78a0795..44d3702b 100755 --- a/qvm-tools/qvm-backup +++ b/qvm-tools/qvm-backup @@ -44,6 +44,14 @@ def main(): help="The AppVM to send backups to (implies -e)") parser.add_option ("-e", "--encrypt", action="store_true", dest="encrypt", default=False, help="Encrypts the backup") + parser.add_option ("-E", "--enc-algo", action="store", + dest="crypto_algorithm", default=None, + help="Specify non-default encryption algorithm. For list of supported algos execute 'openssl list-cipher-algorithms'") + parser.add_option ("-H", "--hmac-algo", action="store", + dest="hmac_algorithm", default=None, + help="Specify non-default hmac algorithm. For list of " + "supported algos execute 'openssl " + "list-message-digest-algorithms'") parser.add_option ("-z", "--compress", action="store_true", dest="compress", default=False, help="Compress the backup") @@ -121,12 +129,18 @@ def main(): print >>sys.stderr, "ERROR: Password mismatch" exit(1) + kwargs = {} + if options.hmac_algorithm: + kwargs['hmac_algorithm'] = options.hmac_algorithm + if options.crypto_algorithm: + kwargs['crypto_algorithm'] = options.crypto_algorithm + try: backup_do(base_backup_dir, files_to_backup, passphrase, progress_callback=print_progress, encrypted=options.encrypt, compressed=options.compress, - appvm=appvm) + appvm=appvm, **kwargs) except QubesException as e: print >>sys.stderr, "ERROR: %s" % str(e) exit(1)