~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/scripts/decrypt_old_ssl

  • Committer: Reinhard Tartler
  • Date: 2008-08-06 13:15:04 UTC
  • Revision ID: siretart@tauware.de-20080806131504-lm6wr3syvblxmm4b
import cryptsetup_1.0.6-3.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
decrypt_ssl () {
4
4
        local key tmpkey rc tries maxtries
5
5
        key="$1"
6
 
        rc=0
7
6
        tmpkey=$(tempfile)
8
 
        maxtries=3
9
7
 
10
8
        echo "Performing (deprecated) two-pass-ssl decryption" >&2
11
 
        tries=0
12
 
        while [ $tries -lt $maxtries ]; do
13
 
                if /usr/bin/openssl enc -aes256 -d -salt -in $key -out $tmpkey > /dev/null 2>&1; then
14
 
                        break
15
 
                fi
16
 
                tries=$(( $tries + 1))
17
 
        done
18
 
 
19
 
        if [ $tries -eq $maxtries ]; then
20
 
                echo "Maximum number of tries exceeded" >&2
21
 
                exit 1
22
 
        fi
23
 
 
24
 
        tries=0
25
 
        while [ $tries -lt 3 ]; do
26
 
                if /usr/bin/openssl dsa -in $tmpkey 2> /dev/null; then
27
 
                        break
28
 
                fi
29
 
                tries=$(( $tries + 1))
30
 
        done
 
9
        if ! /usr/bin/openssl enc -aes256 -d -salt -in $key -out $tmpkey > /dev/null 2>&1; then
 
10
                echo "First pass decryption failed" >&2
 
11
                return 1
 
12
        fi
 
13
 
 
14
        if ! /usr/bin/openssl dsa -in $tmpkey 2> /dev/null; then
 
15
                echo "Second pass decryption failed" >&2
 
16
                rm -f "$tmpkey"
 
17
                return 1
 
18
        fi
31
19
 
32
20
        rm -f "$tmpkey"
33
 
        if [ $tries -eq $maxtries ]; then
34
 
                echo "Maximum number of tries exceeded" >&2
35
 
                exit 1
36
 
        fi
37
 
 
38
21
        return 0
39
22
}
40
23