/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-keygen

  • Committer: Teddy Hogeborn
  • Date: 2008-09-13 15:36:18 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080913153618-atp386q2bqj0ku99
* Makefile (install-client-nokey): Do "&&" instead of ";" to catch
                                   errors.

* README: Kill the straight quotes.  Add copyright notice.

* overview.xml: Improved wording.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
KEYCOMMENT_ORIG="$KEYCOMMENT"
36
36
mode=keygen
37
37
 
 
38
if [ ! -d "$KEYDIR" ]; then
 
39
    KEYDIR="/etc/mandos/keys"
 
40
fi
 
41
 
38
42
# Parse options
39
43
TEMP=`getopt --options vhd:t:l:n:e:c:x:f \
40
44
    --longoptions version,help,password,dir:,type:,length:,subtype:,sublength:,name:,email:,comment:,expire:,force \
148
152
        [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|*) FORCE=0;;
149
153
    esac
150
154
    
151
 
    if { [ -e "$SECKEYFILE" ] || [ -e "$PUBKEYFILE" ]; } \
152
 
        && [ "$FORCE" -eq 0 ]; then
 
155
    if [ \( -e "$SECKEYFILE" -o -e "$PUBKEYFILE" \) \
 
156
        -a "$FORCE" -eq 0 ]; then
153
157
        echo "Refusing to overwrite old key files; use --force" >&2
154
158
        exit 1
155
159
    fi
254
258
    FINGERPRINT="`gpg --quiet --batch --no-tty --no-options \
255
259
        --enable-dsa2 --homedir \"$RINGDIR\" --trust-model always \
256
260
        --fingerprint --with-colons \
257
 
        | sed -n -e '/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
 
261
        | sed --quiet \
 
262
        --expression='/^fpr:/{s/^fpr:.*:\\([0-9A-Z]*\\):\$/\\1/p;q}'`"
258
263
    
259
264
    test -n "$FINGERPRINT"
260
265
    
262
267
    
263
268
    stty -echo
264
269
    echo -n "Enter passphrase: " >&2
265
 
    sed -e '1q' \
 
270
    head --lines=1 | tr --delete '\n' \
266
271
        | gpg --quiet --batch --no-tty --no-options --enable-dsa2 \
267
272
        --homedir "$RINGDIR" --trust-model always --armor --encrypt \
268
273
        --recipient "$FINGERPRINT" --comment "$FILECOMMENT" \
276
281
        fingerprint = $FINGERPRINT
277
282
        secret =
278
283
EOF
279
 
    sed -n -e '
 
284
    sed --quiet --expression='
280
285
        /^-----BEGIN PGP MESSAGE-----$/,/^-----END PGP MESSAGE-----$/{
281
286
            /^$/,${
282
287
                # Remove 24-bit Radix-64 checksum