#!/usr/bin/env bash set -Eeuo pipefail yellow "Exporting public key..." gpg --export --armor -a EuAndreh > keys.gpg green "Done." yellow "Exporting private key..." read -p "A prompt for the GPG password will appear! (Press any key to continue)" -n 1 -r gpg --export-secret-keys --armor -a EuAndreh >> keys.gpg green "Done." yellow "Exporting ownertrust..." gpg --export-ownertrust > trust.txt green "Done." yellow "Creating tar with key pair and trust content..." tar -cvf EuAndreh.tar keys.gpg trust.txt green "Done." yellow "Encrypting tar file..." read -p "A prompt for the symmetric encryption key of the keys.gpg file will appear! (Press any key to continue)" -n 1 -r gpg --cipher-algo AES256 -c EuAndreh.tar green "Done." yellow "Removing traces of private key..." shred trust.txt rm trust.txt shred keys.gpg rm keys.gpg shred EuAndreh.tar rm EuAndreh.tar green "Done." blue "File 'EuAndreh.tar.gpg' created!"