Now GPG keys are not only determined by attachment MIME type. Even inline GPG keys work now.

This commit is contained in:
fkrone 2015-01-18 19:54:08 +01:00
parent fd1b7517db
commit f5976060c8
2 changed files with 16 additions and 7 deletions

View File

@ -12,7 +12,7 @@ For installation instructions, please refer to the included INSTALL file.
- gpg-mailgate-web extension is a web interface allowing any user to upload PGP keys so that emails sent to them from your mail server will be encrypted (see gpg-mailgate-web directory for details)
- people can submit their public key like to any keyserver to gpg-mailgate with the gpg-mailgate-web extension
- people can send an S/MIME signed email to register@yourdomain.tld to register their public key
- people can send their public OpenPGP key as attachment to register@yourdomain.tld to register it
- people can send their public OpenPGP key as attachment or inline to register@yourdomain.tld to register it
This is forked from the original project at http://code.google.com/p/gpg-mailgate/
@ -30,10 +30,12 @@ This is a combined work of many developers and contributor:s
* Bruce Markey - [GitHub](https://github.com/TheEd1tor)
* Remko Tronçon - [GitHub](https://github.com/remko/phkp/)
* Kiritan Flux [GitHub](https://github.com/kflux)
* Fabian Krone [GitHub] (https://github.com/fkrone/gpg-mailgate)
# To Do
* clean up code
* <del>add optional email registration with attached public key to register@domain.tld</del> done
* outsource templates for emails and mailgate-web
* rewrite templates for register-handler
* rewrite and improve installation instructions
* rename from gpg-mailgate to openpgp-s-mime-mailgate or something.....
* even more magical stuff

View File

@ -42,12 +42,19 @@ if __name__ == "__main__":
sign_part = None
for msg_part in register_msg.walk():
if msg_part.get_content_type().lower() == "application/pkcs7-signature" or msg_part.get_content_type().lower() == "application/x-pkcs7-signature":
sign_type = 'smime';
sign_type = 'smime'
sign_part = msg_part
break
elif msg_part.get_content_type().lower() == "application/pgp-keys":
sign_type = 'pgp';
sign_part = msg_part
sign_type = 'pgp'
sign_part = msg_part.get_payload()
break
elif "-----BEGIN PGP PUBLIC KEY BLOCK-----" in msg_part.get_payload() and "-----END PGP PUBLIC KEY BLOCK-----" in msg_part.get_payload():
msg_content = msg_part.get_payload()
start = msg_content.find("-----BEGIN PGP PUBLIC KEY BLOCK-----")
end = msg_content.find("-----END PGP PUBLIC KEY BLOCK-----")
sign_type = 'pgp'
sign_part = msg_content[start:end + 34]
break
if sign_part == None:
@ -89,7 +96,7 @@ if __name__ == "__main__":
elif sign_type == 'pgp':
# send POST to localost on port 11371 which points to our HTTP registration page
sig = sign_part.get_payload()
sig = sign_part
payload = {'email': from_addr, 'key': sig}
r = requests.post("http://127.0.0.1:11371", data=payload)