🔐 What is PGP?
PGP (Pretty Good Privacy) is encryption software that uses two keys:
- Public Key: Share with others - they encrypt messages for you
- Private Key: Keep secret - you decrypt messages meant for you
Why DrugHub Requires PGP
- Mandatory PGP Login: Proves you control the private key
- Address Encryption: Shipping addresses must be encrypted
- Secure Communication: Messages with vendors are encrypted
- Signature Verification: Verify you're talking to real admins/vendors
📥 Installing PGP Software
Windows: Kleopatra (Gpg4win)
- Download from official site: gpg4win.org
- Run installer, select "Kleopatra" component
- Complete installation
- Launch Kleopatra from Start Menu
macOS: GPG Suite
- Download from: gpgtools.org
- Run installer package
- Complete installation
- Launch GPG Keychain
Linux: GnuPG (Usually Pre-installed)
# Check if installed
gpg --version
# Install if needed
sudo apt-get install gnupg2
sudo apt-get install kleopatra # GUI
🔑 Generating Your PGP Key Pair
Using Kleopatra (Windows/Linux GUI)
- Open Kleopatra
- Click "New Key Pair" → "Create a personal OpenPGP key pair"
- Fill out form:
- Name: Use pseudonym (e.g., "DrugHubUser2025")
- Email: Fake email or leave blank (e.g., "user@localhost")
- Click "Advanced Settings"
- Set:
- Key Material: RSA
- Key Size: 4096 bits (REQUIRED by DrugHub)
- Valid until: Never expires OR 2+ years
- Click "OK" then "Create"
- Enter strong passphrase (20+ characters, store in password manager)
- Wait for key generation (may take 1-2 minutes)
Using Command Line (Linux)
gpg --full-generate-key
# Select: (1) RSA and RSA
# Key size: 4096
# Expiration: 0 (never) or 2y
# Name: DrugHubUser2025
# Email: user@localhost
# Enter strong passphrase
- Minimum 20 characters
- Mix uppercase, lowercase, numbers, symbols
- NOT related to personal information
- Store in KeePassXC or similar
- If lost, you lose access to account permanently
📤 Exporting Your Keys
Export Public Key (Share with Others)
Kleopatra:
- Right-click your key → "Export"
- OR: Right-click → "Copy" → "Copy Public Key"
- Paste into DrugHub registration form
Command Line:
# List keys to get Key ID
gpg --list-keys
# Export public key
gpg --armor --export YOUR_KEY_ID
Backup Private Key (CRITICAL)
Kleopatra:
- Right-click your key → "Export Secret Keys"
- Save to encrypted USB drive or secure location
- NEVER upload to cloud or email
Command Line:
gpg --armor --export-secret-keys YOUR_KEY_ID > private-key-backup.asc
Storage Recommendations:
- Store on encrypted USB drive
- Use VeraCrypt encrypted container
- Multiple offline backups in separate locations
- Never store on cloud (Dropbox, Google Drive, etc.)
🔒 Encrypting Messages
Encrypting for Others (e.g., Shipping Address for Vendor)
Step 1: Import Recipient's Public Key
Copy vendor's public key from their profile → Kleopatra → "Import" → Paste
Step 2: Encrypt Your Message
Kleopatra:
- Click "Notepad" icon (Encrypt/Decrypt Notepad)
- Type your message (shipping address, etc.)
- Click "Encrypt"
- Select recipient's public key
- Copy encrypted message (starts with
-----BEGIN PGP MESSAGE-----) - Paste into DrugHub order form
Command Line:
# Encrypt file
gpg --encrypt --armor --recipient VENDOR_KEY_ID message.txt
# Or encrypt text directly
echo "Your message here" | gpg --encrypt --armor --recipient VENDOR_KEY_ID
Example Encrypted Shipping Address
-----BEGIN PGP MESSAGE-----
hQIMA+9K7xK3VqPeAQ/+MmxKz7TZG4RI8...(encrypted data)...vC2
=abCD
-----END PGP MESSAGE-----
🔓 Decrypting Messages
Decrypting PGP Login Challenge
When you login to DrugHub, you'll receive an encrypted challenge. Here's how to decrypt it:
Kleopatra:
- Copy the entire encrypted message from DrugHub (including headers)
- Open Kleopatra → Click "Decrypt/Verify"
- Paste the encrypted message
- Enter your PGP passphrase
- Copy the decrypted code (usually 6-8 characters)
- Paste code back into DrugHub login page
Command Line:
# Decrypt from clipboard
gpg --decrypt
(paste encrypted message, press Ctrl+D)
✍️ Signing & Verifying Messages
Why Signatures Matter
Signatures prove a message came from the key owner. Always verify admin/vendor signatures to prevent phishing.
Verifying a Signature
Kleopatra:
- Copy signed message
- Click "Decrypt/Verify"
- Paste message
- Check result: ✓ Valid signature from [Name]
Signing Your Messages
Kleopatra:
- Open notepad, type message
- Click "Sign"
- Select your key
- Enter passphrase
- Copy signed message
📱 Two-Factor Authentication (2FA)
Setup 2FA on DrugHub
- Login to DrugHub
- Navigate to: Settings → Security → Two-Factor Authentication
- Click "Enable 2FA"
- Scan QR code with authenticator app:
- Recommended: Authy, Aegis (Android), Raivo (iOS)
- Avoid: Google Authenticator (no backups)
- Enter 6-digit code to verify
- SAVE BACKUP CODES - Store in password manager
Using 2FA for Login
- Enter username and password
- Decrypt PGP challenge
- Enter 2FA code from authenticator app
- Successfully logged in
🔧 Common PGP Issues
❌ "Invalid PGP Key" on Registration
Cause: Key not 4096-bit or incomplete paste
Solution:
- Verify key is exactly 4096 bits (check advanced settings)
- Ensure entire key including headers copied:
-----BEGIN PGP PUBLIC KEY BLOCK-----to-----END PGP PUBLIC KEY BLOCK----- - Remove extra spaces/line breaks
❌ Can't Decrypt Login Challenge
Causes:
- Wrong private key selected (if you have multiple)
- Incorrect passphrase
- Incomplete encrypted message copied
Solution:
- Verify you're using the same key pair as registration
- Copy entire encrypted block including headers
- Double-check passphrase in password manager
❌ "No secret key" Error
Cause: Private key not imported or missing
Solution:
- Import your private key backup
- Verify key ownership with:
gpg --list-secret-keys
🎯 PGP Best Practices
- ✅ Use 4096-bit RSA keys minimum
- ✅ Create strong 20+ character passphrase
- ✅ Backup private key to multiple offline locations
- ✅ Enable 2FA on DrugHub account
- ✅ Save 2FA backup codes
- ✅ Verify signatures on admin/vendor messages
- ✅ Use different PGP key for DrugHub (don't reuse personal keys)
- ✅ Test encryption/decryption before first order
- ❌ Never share private key
- ❌ Never upload private key to cloud
- ❌ Never email private key
- ❌ Never reuse PGP key from clearnet identity