gpgコマンドで暗号化したいデータをパイプで流し込みたいときの設定
以下のように環境変数GPG_TTYにttyをセットすれば良い。
code:bash
export GPG_TTY=$(tty)
そうすると、以下のように暗号化したいデータを流し込んで、暗号データを取得することが出来る。
$ cat hello.txt | gpg -c | base64
gpgコマンドにttyからパスワードが入力できるオプションがあると嬉しい。 もし、GPG_TTY=$(tty)しないデフォルトの場合は以下のようなエラーが出る。
code:エラー
gpg: problem with the agent: Inappropriate ioctl for device
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of 'stdin' failed: Operation cancelled