π« Postbox is a lightweight encryption tool which allows users to generate key pairs, exchange public keys, encrypt and decrypt messages, and communicate securely over SMTP using the RSA-2048/4096 algorithm.
-
Clone the repository:
git clone https://github.com/tarranprior/Postbox
-
Change to the directory.
cd Postbox
-
Restore the dependencies and run the application using
dotnet
:dotnet restore dotnet run Postbox --help
-
You can also use π Docker by running:
docker build -t postbox . docker volume create postbox_keys
You must also change the
SMTP_SERVER
value in the.env
file tohost.docker.internal
, and disable SSL withSMTP_SSL=FALSE
(or import the SSL certificate to Docker).SMTP_SERV=YOUR_SMTP_SERVER SMTP_PORT=YOUR_SMTP_PORT SMTP_SSL=TRUE SMTP_USER=YOUR_EMAIL_ADDRESS SMTP_PASS=YOUR_PASSWORD # SMTP_SERVER=host.docker.internal # for Docker # SMTP_SSL=FALSE # for Docker
-
Install and configure a local SMTP Server like Proton Bridge.
-
Export the certificate and install:
** Import the certificate: PS C:\> Import-Certificate -FilePath "./cert.pem" -CertStoreLocation Cert:\CurrentUser\Root ** Ensure SMTP is active: PS C:\> Get-NetTCPConnection -LocalPort 1025 LocalAddress LocalPort RemoteAddress ------------ --------- ------------- 127.0.0.1 1025 0.0.0.0
-
Update the values in
.env.EXAMPLE
and rename to.env
.SMTP_SERV=YOUR_SMTP_SERVER * Defaults to 127.0.0.1 SMTP_PORT=YOUR_SMTP_PORT * Defaults to 1025 SMTP_USER=YOUR_EMAIL_ADDRESS SMTP_PASS=YOUR_PASSWORD
The SMTP_USER
value will be the name of your public and private keys: YOUR_EMAIL_ADDRESS_public.pem
and YOUR_EMAIL_ADDRESS_private.pem
. These will then act as the default keys when encrypting and decrypting messages.
Description:
π« Postbox is a lightweight encryption tool which allows users to generate key pairs,
exchange public keys, encrypt and decrypt messages, and communicate securely over SMTP using RSA.
Usage:
Postbox [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
generate-keys Generates a new key pair.
encrypt-message <message> <key> Encrypts a message.
decrypt-message <message> <key> Decrypts a message.
import-key <key> <email> Imports a key from a local file.
send-key <key> <email> Emails a public key to a recipient.
send-message <message> <email> Sends an encrypted message to a recipient.
generate-keys Generates a new key pair.
> dotnet run -- generate-keys
> dotnet run -- generate-keys --bits 4096
import-key <key> <email> Imports a key from a local file.
> dotnet run -- import-key "path/to/key.pem" "email@example.com"
> dotnet run -- import-key --key "path/to/key.pem" --email "email@example.com"
** Output:
[00:00:00 INF] π₯ Key successfully imported for `email@example.com`.
send-key <key> <email> Emails a public key to a recipient.
> dotnet run -- send-key "recipient_email@example.com"
> dotnet run -- send-key --key "email@example.com" --email "recipient_email@example.com"
** Output:
[00:00:00 INF] π© Dispatching email to `recipient_email@example.com` via 127.0.0.1:1025...
[00:00:00 INF] Email has been sent successfully.
encrypt-message <message> <key> Encrypts a message.
> dotnet run -- encrypt-message "Foo!" "email@example.com"
> dotnet run -- encrypt-message --message "Foo!" --key "email@example.com"
> dotnet run -- encrypt-message -m "Foo!" -k "email@example.com"
** Output:
[00:00:00 INF] Message: GTMDAql3cgoOoeL/1qYvDNzIaQrMWxC4Fg8QAQ1wdKgyfXPNGi4PzfCmOuNR8I4ixLW99Du745Q
cn6FSbQnpZsFAg8vC+I+Dr9sVV9waS4gRnW+sIliuNRse77tUB6SzYPjZnbJDx4cXcxEcOSz4e8xxnGa7xiA98/rp71RNEQE1Wu
MYQgrTXyl1qRWPse++zvyWaIqj39p4IiJcfm1a4SuMYvoGGkvu4dupTCcYQrvAbxOUqdccJvg4yOYx0S5HhcuRxzN6EUYkGTSsy
0uS33eAwMSEOhI99fsj4LshxMius7fZA9Fm5We5rjdhtTwWxwLEzkfqYCZh7jE/YHxGVQ==
decrypt-message <message> <key> Decrypts a message.
> dotnet run -- decrypt-message "GTMDAql3cgoOoeL/1qYvDNzIaQrM/..."
> dotnet run -- decrypt-message --message "GTMDAql3cgoOoeL/1qYvDNzIaQrM/..." --key "email@example.com"
** Output:
[00:00:00 INF] Message: Foo!
send-message <message> <email>
> dotnet run -- send-message "Foo!" "recipient_email@example.com"
> dotnet run -- send-message --message "Foo!" --email "recipient_email@example.com"
** Output:
[00:00:00 INF] π© Dispatching email to `recipient_email@example.com` via 127.0.0.1:1025...
[00:00:00 INF] Email has been sent successfully.