Skip to content

Latest commit

 

History

History
151 lines (118 loc) · 2.87 KB

Android_Termux.md

File metadata and controls

151 lines (118 loc) · 2.87 KB

PGP Tools & Commands for Android (Termux)

1. Install Termux

Download and install Termux from:

🔗 F-Droid Termux

2. Install GnuPG (PGP) in Termux

pkg update && pkg upgrade
pkg install gnupg

3. Verify Installation

gpg --version

4. Generate a PGP Key

gpg --full-generate-key

Follow the prompts:

  • Select RSA (default).
  • Choose a key size (4096 recommended).
  • Set an expiration date or choose "no expiration."
  • Enter your name.
  • Choose a strong passphrase.

5. List Existing Keys

# List public keys
gpg --list-keys

# List private (secret) keys
gpg --list-secret-keys

6. Find Your Key Fingerprint

gpg --fingerprint "Your Name"

7. Export & Import PGP Keys

Export a Public Key

gpg --armor --export "Your Name" > public_key.asc

Export a Private Key (Backup Only!)

gpg --armor --export-secret-keys "Your Name" > private_key.asc

Import a PGP Key

gpg --import public_key.asc

8. Encrypt & Decrypt Messages

Encrypt a Message (Command-Line Input, Ctrl+D to End)

gpg --armor --encrypt --recipient "Recipient Name"

Type your message and press Ctrl+D to finish.

Encrypt a File

gpg --armor --encrypt --recipient "Recipient Name" file.txt

Decrypt a Message (Paste Text, Ctrl+D to Process)

gpg --decrypt

Paste the encrypted text, then press Ctrl+D.

Decrypt a File

gpg --decrypt file.txt.asc

9. Sign & Verify Messages

Sign a Message (Ctrl+D to End Input)

gpg --clearsign

Type your message and press Ctrl+D.

Sign a File

gpg --clearsign file.txt

Verify a Signed File

gpg --verify file.txt.asc

10. Encrypt & Decrypt Large Files

Encrypt Large Files (AES-256 Encryption, No Recipient)

gpg --symmetric --cipher-algo AES256 file.tar.gz

Decrypt Large Files

gpg --output file.tar.gz --decrypt file.tar.gz.gpg

11. Revoking a Key

Generate a Revocation Certificate (For Key Compromise Cases)

gpg --output revoke.asc --gen-revoke "Your Name"

Import the Revocation Certificate

gpg --import revoke.asc

12. Remove or Delete Keys

Delete a Public Key

gpg --delete-key "Your Name"

Delete a Private Key

gpg --delete-secret-key "Your Name"

13. Backup & Restore PGP Keys

Export All Keys (For Backup)

gpg --export --armor > all-public-keys.asc
gpg --export-secret-keys --armor > all-private-keys.asc

Restore PGP Keys from Backup

gpg --import all-public-keys.asc
gpg --import all-private-keys.asc