mirror of
https://github.com/sneakybugmaster/mailsender.git
synced 2026-11-10 19:48:49 +00:00
- validation: CertificateValidator checks revocation, expiry, matching user ID, a valid communications encryption subkey and the algorithm policy; uses the earlier expiry when PGPainless and Bouncy Castle disagree - crypto: PgpEncryptor (ASCII armor, hidden recipients for Bcc) - mime: PgpMimeEncryptor builds RFC 3156 multipart/encrypted from the whole CRLF-canonical inner entity, keeping envelope headers in the clear - autoconfigure: validator and encryptor beans - demo: encrypts when a valid key is found, plaintext otherwise - rename groupId and Java packages to pro.thinhha.mailsender Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G71TQ5jDETVwdUJxGAwaiT
1.7 KiB
1.7 KiB
mailsender
OpenPGP encryption for Spring Boot mail: discovers recipients' keys via Web Key Directory (WKD) and sends PGP/MIME (RFC 3156), or hands mail to an encrypting relay. See docs/PLAN.md for the design and milestone status.
Requires JDK 27 and Maven 3.9+. Built on Spring Boot 4.1.1 and PGPainless 2.0.
mvn verify
Modules
| Module | Contents |
|---|---|
mailsender-pgp-core |
WKD key discovery, caching, pinned keys, certificate validation, OpenPGP encryption, PGP/MIME (no Spring) |
mailsender-pgp-spring-boot-autoconfigure |
mail.pgp.* properties and beans |
mailsender-pgp-spring-boot-starter |
dependency bundle for applications |
mailsender-demo |
sample app that sends test mails |
Demo app
The demo app looks up and validates the recipient's key via WKD, then sends DEMO_COUNT test mails
(default: 1 to test@thinhha.pro). With a valid key the mail is PGP/MIME-encrypted (RFC 3156); otherwise it is
sent in plaintext and a warning is logged. The policy layer (REQUIRE / OPPORTUNISTIC / PLAINTEXT, split
delivery) comes in milestone 5.
mvn -q install -DskipTests
SMTP_HOST=smtp.example.com SMTP_PORT=587 \
SMTP_USERNAME=me@example.com SMTP_PASSWORD='app-password' \
DEMO_TO=test@thinhha.pro DEMO_COUNT=1 \
java -jar mailsender-demo/target/mailsender-demo-0.1.0-SNAPSHOT.jar
| Variable | Default | Meaning |
|---|---|---|
SMTP_HOST / SMTP_PORT |
localhost / 587 |
SMTP server |
SMTP_USERNAME / SMTP_PASSWORD |
empty | SMTP credentials |
SMTP_AUTH / SMTP_STARTTLS |
true / true |
set to false for a local test server |
DEMO_TO |
test@thinhha.pro |
recipient |
DEMO_FROM |
SMTP_USERNAME |
sender address |
DEMO_COUNT |
1 |
number of mails |