Filtering spam in mail server, protecting both client privacy and server algorithm

HE Spamfilter

SNUCSE 2021 "Intelligent Computing System Design Project"

  • Hyesun Kwak
  • Myeonghwan Ahn
  • Dongwon Lee

abstract

tested on

how it works

  1. receiver
    • generates keys
    • posts its public key-set on server
      • public key pk, relinearization key rek, rotation key rok
  2. sender
    • writes down some letter
    • in demo, random sample from enron dataset
    • tokenizes the letter
    • in demo, use already-tokenized value from enron dataset
    • make it one-or-zero(occur in letter or not) per embedding
    • gets public key from server
    • encrypt one-or-zero embedding
    • post result on server
  3. receiver
    • get result from server
    • decrypt using secret key

how to run

NOTE that we made some update on ckks/params.go; see sender/setup.sh:17 and sender/params.go

server

cd your_path_to/HE_spamfilter/server

  • install some golang dependency on main.go
  • you need to handle some nasty PATH problem... see sender/setup.sh:11~16

cp ../sender/params.go your_GOPATH/src/github.com/ldsec/lattigo/v2/ckks/params.go

go run main.go

client - sender

cd your_path_to/HE_spamfilter/sender

  • on linux, tar -zxvf enron.tar.gz
  • on mac, gtar -zxvf enron.tar.gz
    • install GNU-tar using brew
    • brew update && brew install gnu-tar

docker run -it -v your_path_to/HE_spamfilter/sender:/home --rm ubuntu:focal

in container shell, cd /home bash setup.sh

client - receiver

docker run -it -v your_path_to/HE_spamfilter/receiver:/home --rm ubuntu:focal

in container shell, cd /home bash setup.sh

demo

with server & two client containers running,

  • receiver python3 demo_keygen.py
  • sender python3 demo_send.py
  • receiver python3 demo_rcv.py

result

  • accuracy
    • accuracy 0.96391
    • F1 score 0.96197
  • latency
    • key post
      • public key (9.1 M) : 2.48 s
      • relinearization key (289 M) : 75 s
      • rotation key (289 M) : 52.87 s
      • by the way, secret key size is 4.6 M
    • key get
      • public key : 432.244 ms
    • message post
      • select random 10
      • POST + HE calculation + some filesystem access time
      • encrypted message : 5.1 M each
      • [1.878, 2.225, 1.636, 2.372, 1.838, 2.232, 1.860, 1.864, 1.839, 3.666] s
    • message get
      • calculation result : 5.1 M each
      • [167, 86, 103, 184, 81, 104, 299, 272, 96, 119] ms

about dataset

MWiechmann/enron_spam_data provides enron_spam_data.csv

We corrected some format error on that to make enron_spam_data_prep.csv, which consists of 33715 e-mails (16545 ham + 17170 spam)

Owner
Myeonghwan Ahn
SNUCSE student
Myeonghwan Ahn
Similar Resources

📧 Example of sending mail via SendGrid in Golang.

📧 go-sendgrid-example Example of sending mail via SendGrid in Golang. Get it started $ make setup # Edit environment variables $ vim ./env/local.env

Jan 11, 2022

Mail_sender - This library is for sending emails from your mail

Mail Sender This library is for sending emails from your mail Installation mail_

Dec 30, 2021

Mcopa - A library allows for parsing an email message into a more convenient form than the net/mail provides

Mail content parsing This library allows for parsing an email message into a mor

Jan 1, 2022

Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade

smtptest Simple tool to test SMTP mail send with various settings including TLS1.1 downgrade All settings are configurable in the config.yaml file ser

Sep 19, 2022

Go-mail - Email service using Kafka consumer

📁 The Project This project consists in a Kafka consumer that reads messages of

Feb 5, 2022

Send markdown files as MIME-encoded electronic mail.

Send markdown files as MIME-encoded electronic mail.

Aug 9, 2022

Go implementation of the JWZ email threading algorithm

Go implementation of the JWZ email threading algorithm

The JWZ Threading algorithm written in Go This is an open source Go implementation of the widely known JWZ message threading algorithm originally writ

Oct 31, 2022

Sending emails using email server talking to RabbitMQ and send grid server sending emails to email ids consumed from RabbitMQ

Sending emails using email server talking to RabbitMQ and send grid server sending emails to email ids consumed from RabbitMQ

Sending emails using email server talking to RabbitMQ and send grid server sending emails to email ids consumed from RabbitMQ

Oct 27, 2022

A simple Go POP3 client library for connecting and reading mails from POP3 servers.

go-pop3 A simple Go POP3 client library for connecting and reading mails from POP3 servers. This is a full rewrite of TheCreeper/go-pop3 with bug fixe

Dec 17, 2022
Related tags
Mail-alias-resolve-ldap - Resolve mail alias addresses in LDAP

alias-resolve-ldap alias-resolve-ldap was written to be used as a hook for the c

Jan 30, 2022
a simple api that sent spam via sms and email

a simple api that sent spam via sms and email routes: /sms /email example request with python

Oct 19, 2021
✉️ Composable all-in-one mail server.

Maddy Mail Server Composable all-in-one mail server. Maddy Mail Server implements all functionality required to run a e-mail server. It can send messa

Dec 27, 2022
:envelope: A streaming Go library for the Internet Message Format and mail messages

go-message A Go library for the Internet Message Format. It implements: RFC 5322: Internet Message Format RFC 2045, RFC 2046 and RFC 2047: Multipurpos

Dec 26, 2022
MIME mail encoding and decoding package for Go

enmime enmime is a MIME encoding and decoding library for Go, focused on generating and parsing MIME encoded emails. It is being developed in tandem w

Nov 30, 2022
Sieve email filtering language (RFC 5228) implementation in Go.

go-sieve Sieve email filtering language (RFC 5228) implementation in Go.

Sep 29, 2022
Inline styling for html mail in golang

go-premailer Inline styling for HTML mail in golang Document install go get github.com/vanng822/go-premailer/premailer Example import ( "fmt" "gith

Nov 30, 2022
Golang package that generates clean, responsive HTML e-mails for sending transactional mail
Golang package that generates clean, responsive HTML e-mails for sending transactional mail

Hermes Hermes is the Go port of the great mailgen engine for Node.js. Check their work, it's awesome! It's a package that generates clean, responsive

Dec 28, 2022
Go library for sending mail with the Mailgun API.

Mailgun with Go Go library for interacting with the Mailgun API. Usage package main import ( "context" "fmt" "log" "time" "githu

Dec 25, 2022
an MDA that sends a webhook on recieval of mail

an MDA that sends a webhook on recieval of mail

Aug 13, 2022