| 
				
			 | 
			
			
				@@ -51,37 +51,61 @@ function gpg_set_permissions { 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				51
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				52
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				53
			 | 
			
				53
			 | 
			
			
				 function reconstruct_key { 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				
			 | 
			
			
				-    if [ ! -d /home/$MY_USERNAME/.gnupg_fragments ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+    key_username=$1 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+    key_interactive=$2 
			 | 
		
	
		
			
			| 
				
			 | 
			
				56
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				+    if [ ! -d /home/$key_username/.gnupg_fragments ]; then 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				58
			 | 
			
			
				         return 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				59
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				
			 | 
			
			
				-    cd /home/$MY_USERNAME/.gnupg_fragments 
			 | 
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				+    cd /home/$key_username/.gnupg_fragments 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				61
			 | 
			
			
				     no_of_shares=$(ls -afq keyshare.asc.* | wc -l) 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				62
			 | 
			
			
				     if (( no_of_shares < 4 )); then 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				
			 | 
			
			
				-        dialog --title $"Recover Encryption Keys" --msgbox $'Not enough fragments to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+        if [ $key_interactive ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+            dialog --title $"Recover Encryption Keys" --msgbox $'Not enough fragments to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+        else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+            echo $'Not enough fragments to reconstruct the key' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				68
			 | 
			
			
				         exit 7348 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				69
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				70
			 | 
			
			
				     apt-get -yq install libgfshare-bin gnupg 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				-    gfcombine /home/$MY_USERNAME/.gnupg_fragments/keyshare* 
			 | 
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				+    gfcombine /home/$key_username/.gnupg_fragments/keyshare* 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				72
			 | 
			
			
				     if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				-        dialog --title $"Recover Encryption Keys" --msgbox $'Unable to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				+        if [ $key_interactive ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				+            dialog --title $"Recover Encryption Keys" --msgbox $'Unable to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				+        else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+            echo $'Unable to reconstruct the key' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				78
			 | 
			
			
				         exit 7348 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				79
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				80
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				-    KEYS_FILE=/home/$MY_USERNAME/.gnupg_fragments/keyshare.asc 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+    KEYS_FILE=/home/$key_username/.gnupg_fragments/keyshare.asc 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				82
			 | 
			
			
				     if [ ! -f $KEYS_FILE ]; then 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-        dialog --title $"Recover Encryption Keys" --msgbox $'Unable to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+        if [ $key_interactive ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				+            dialog --title $"Recover Encryption Keys" --msgbox $'Unable to reconstruct the key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+        else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+            echo $'Unable to reconstruct the key' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+        exit 52852 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				89
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				90
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				-    gpg --homedir=/home/$MY_USERNAME/.gnupg --allow-secret-key-import --import $KEYS_FILE 
			 | 
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				+    gpg --homedir=/home/$key_username/.gnupg --allow-secret-key-import --import $KEYS_FILE 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				92
			 | 
			
			
				     if [ ! "$?" = "0" ]; then 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				-        echo $'Unable to import gpg key' 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				93
			 | 
			
			
				         shred -zu $KEYS_FILE 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				
			 | 
			
			
				-        rm -rf /home/$MY_USERNAME/.tempgnupg 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				
			 | 
			
			
				-        exit 9654 
			 | 
		
	
		
			
			| 
				
			 | 
			
				94
			 | 
			
			
				+        rm -rf /home/$key_username/.tempgnupg 
			 | 
		
	
		
			
			| 
				
			 | 
			
				95
			 | 
			
			
				+        if [ $key_interactive ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				+            dialog --title $"Recover Encryption Keys" --msgbox $'Unable to import gpg key' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				+        else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				+            echo $'Unable to import gpg key' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				+        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				+        exit 96547 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				101
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				102
			 | 
			
			
				     shred -zu $KEYS_FILE 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				103
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				-    dialog --title $"Recover Encryption Keys" --msgbox $'Key has been reconstructed' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				+    if [ $key_interactive ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				105
			 | 
			
			
				+        dialog --title $"Recover Encryption Keys" --msgbox $'Key has been reconstructed' 6 70 
			 | 
		
	
		
			
			| 
				
			 | 
			
				106
			 | 
			
			
				+    else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				+        echo $'Key has been reconstructed' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				108
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				109
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				110
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				87
			 | 
			
				111
			 | 
			
			
				 function interactive_gpg_from_usb { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -98,7 +122,7 @@ function interactive_gpg_from_usb { 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				122
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				99
			 | 
			
				123
			 | 
			
			
				         if [ ! -b $USB_DRIVE ]; then 
			 | 
		
	
		
			
			| 
				100
			 | 
			
				124
			 | 
			
			
				             if (( GPG_CTR > 0 )); then 
			 | 
		
	
		
			
			| 
				101
			 | 
			
				
			 | 
			
			
				-                reconstruct_key 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+                reconstruct_key $MY_USERNAME interactive 
			 | 
		
	
		
			
			| 
				102
			 | 
			
				126
			 | 
			
			
				                 return 0 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				127
			 | 
			
			
				             fi 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				128
			 | 
			
			
				             dialog --title $"Recover Encryption Keys" --msgbox $'No USB drive found' 6 30 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -110,7 +134,7 @@ function interactive_gpg_from_usb { 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				134
			 | 
			
			
				         if [ ! -d $USB_MOUNT ]; then 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				135
			 | 
			
			
				             if (( GPG_CTR > 0 )); then 
			 | 
		
	
		
			
			| 
				112
			 | 
			
				136
			 | 
			
			
				                 backup_unmount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				113
			 | 
			
				
			 | 
			
			
				-                reconstruct_key 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+                reconstruct_key $MY_USERNAME interactive 
			 | 
		
	
		
			
			| 
				114
			 | 
			
				138
			 | 
			
			
				                 return 0 
			 | 
		
	
		
			
			| 
				115
			 | 
			
				139
			 | 
			
			
				             fi 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				140
			 | 
			
			
				             dialog --title $"Recover Encryption Keys" \ 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -123,7 +147,7 @@ function interactive_gpg_from_usb { 
			 | 
		
	
		
			
			| 
				123
			 | 
			
				147
			 | 
			
			
				             if [ ! -d $USB_MOUNT/.gnupg_fragments ]; then 
			 | 
		
	
		
			
			| 
				124
			 | 
			
				148
			 | 
			
			
				                 if (( GPG_CTR > 0 )); then 
			 | 
		
	
		
			
			| 
				125
			 | 
			
				149
			 | 
			
			
				                     backup_unmount_drive ${USB_DRIVE} 
			 | 
		
	
		
			
			| 
				126
			 | 
			
				
			 | 
			
			
				-                    reconstruct_key 
			 | 
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				+                    reconstruct_key $MY_USERNAME interactive 
			 | 
		
	
		
			
			| 
				127
			 | 
			
				151
			 | 
			
			
				                     return 0 
			 | 
		
	
		
			
			| 
				128
			 | 
			
				152
			 | 
			
			
				                 fi 
			 | 
		
	
		
			
			| 
				129
			 | 
			
				153
			 | 
			
			
				                 dialog --title $"Recover Encryption Keys" \ 
			 |