?? epic-crypt-gpg-aa
字號:
#!/bin/bash## This script demonstrates ascii armoring. It is rather complicated# because it uses the ascii armoring present in gpg, which wraps in# a way that is unusable for irc. One of the things that can be# done is to join all the cyphertext lines together, and reformat# them into a valid gpg message again at the other end.## Decryption is a little tricky. What we do is create a token ascii# armored gpg message, strip it of the message content, fill it in# with the reformatted message and pipe it back into gpg for# decryption.## Since the plaintext and cyphertext are read in non-newline binary# mode, echo -n is used.function encrypt { ( echo "$KEY" ; cat ) | gpg -ca -z 9 --batch --passphrase-fd 0 | ( while read && [ -n "$REPLY" ] ; do : ; done while read && [ -n "$REPLY" ] ; do [ -n "$LAST" ] && echo -n "$LAST " ; LAST="$REPLY" done )}function decrypt { read -a input ( echo x | gpg -ca --batch --passphrase-fd 0 | ( while read && [ -n "$REPLY" ] ; do echo "$REPLY" ; done while read && [ -n "$REPLY" ] ; do LAST="$REPLY" ; done echo for foo in "${input[@]}" ; do echo "$foo" ; done echo "$LAST" ) ) | ( echo "$KEY" ; cat ) | gpg -a --batch --passphrase-fd 0}proto="$1"shift 1read KEY TRASHcase "$proto" inencrypt) encrypt "$@" ;;decrypt) decrypt "$@" ;;*) echo `basename $0` "{encrypt|decrypt} < text" 1>&2 ;;esac
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -