~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/scripts/decrypt_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:
5
5
#
6
6
 
7
7
decrypt_ssl () {
8
 
        local tries maxtries
9
 
        maxtries=3
10
 
        tries=0
11
 
 
12
 
        echo -e "\nDecrypting ssl key $1..." >&2
13
 
        while [ $tries -lt $maxtries ]; do
14
 
                if /usr/bin/openssl enc -aes-256-cbc -d -salt -in $1 2> /dev/null 2>&1; then
15
 
                        break
16
 
                fi
17
 
                tries=$(( $tries + 1))
18
 
        done
19
 
        rm -f $tmpkey
20
 
 
21
 
        if [ $tries -eq $maxtries ]; then
22
 
                echo -e "\nMaximum number of attempts exceeded" >&2
23
 
                exit 1
 
8
        echo "" >&2
 
9
        echo "Decrypting ssl key $1..." >&2
 
10
        if ! /usr/bin/openssl enc -aes-256-cbc -d -salt -in $1 2> /dev/null 2>&1; then
 
11
                return 1
24
12
        fi
 
13
        return 0
25
14
}
26
15
 
27
16
decrypt_ssl $1
 
17
return $?