SlideShare a Scribd company logo
1 of 21
Download to read offline
Django-sem,
how to make SignedEmailMessage
out of EmailMessage in few simple
             steps.
           Jakub Wasielak, 2012
Identity verification

  Why?
● Easier bureaucracy


●   Fraud prevention
●   Enabling law
●   Interpersonal communication
Identity verification

  How?
● Ancient times




Mostly verbal verification
Identity verification

  How?
● Ancient times      Mostly verbal verification
●   Middle Ages


    Sealing wax
Identity verification

  How?
● Ancient times       Mostly verbal verification
●   Middle Ages        Sealing wax
●   Before internet

    Stamps
Identity verification

  How?
● Ancient times       Mostly verbal verification
●   Middle Ages        Sealing wax
●   Before internet    Stamps
●   Now

    S/MIME
Public-key infrastructure

Creating, managing, using, storing, and
revoking Digital Certificates.
Public-key infrastructure

All the stuff connected with
           Digital Certificates.
Public-key infrastructure

All the stuff connected with
           Digital Certificates.

CA – Certificate Authority – the unit capable
of issuing and verifying the digital
certificates.
Digital Certificate

    X.509 (PKI)
●   Signature Algorithm – selected by CA
●   Issuer – CA itself
●   Subject – your data
●   Subject Public Key – your public key
●   Certificate signature – the actual signature
●   Version, Serial Number, Validity
Digital Certificate
Certificate:
 Data:
    Version: 1 (0x0)
    Serial Number: 7829 (0x1e95)
    Signature Algorithm: md5WithRSAEncryption
    Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc,
          OU=Certification Services Division,
          CN=Thawte Server CA/emailAddress=server-certs@thawte.com
    Validity
        Not Before: Jul 9 16:04:02 1998 GMT
        Not After : Jul 9 16:04:02 1999 GMT
    Subject: C=US, ST=Maryland, L=Pasadena, O=Brent Baccala,
           OU=FreeSoft, CN=www.freesoft.org/emailAddress=baccala@freesoft.org
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
        RSA Public Key: (1024 bit)
          Modulus (1024 bit):
             00:b4:31:98:0a:c4:bc:62:c1:88:aa:dc:b0:c8:bb:
             ...
             e8:35:1c:9e:27:52:7e:41:8f
          Exponent: 65537 (0x10001)
 Signature Algorithm: md5WithRSAEncryption
    93:5f:8f:5f:c5:af:bf:0a:ab:a5:6d:fb:24:5f:b6:59:5d:9d:
    ...
    8f:0e:fc:ba:1f:34:e9:96:6e:6c:cf:f2:ef:9b:bf:de:b5:22
Signed mail in
          Thunderbird
Signed mail in
             Outlook
Signed mail in
       some apple client
Signed mail in
              Gmail




     ?
Signing – first steps
MeTooCrypto:

M2Crypto is the most complete Python
wrapper for OpenSSL featuring RSA, DSA,
DH, HMACs, message digests, symmetric
ciphers, SSL functionality, HTTPS, urllib,
xmlrpclib, HMAC'ing AuthCookies,
FTP/TLS, S/MIME, ZserverSSL and
ZSmime.
Signing – first steps
MeTooCrypto:

M2Crypto is not well documented.
SignedEmailMessage – a week later
 1. Add 'SEM' into INSTALLED_APPS.
 2. Add DEFAULT_CHARSET and
 AUTH_CERT into setting.
 3. Use it.
1. Add 'SEM' into INSTALLED_APPS.

 pip install django-sem

   INSTALLED_APPS = (
       ...
       'SEM',
       ...
       )
2. Add DEFAULT_CHARSET and
AUTH_CERT into setting.
 DEFAULT_CHARSET = 'utf-8'
 AUTH_CERT = "resources/cert.pem"

/resources/cert.pem

   -----BEGIN CERTIFICATE-----
   AGSJGAS34BDS4htg0234gADSG923ng92G3h2tgjs9afgf
   ...
   ...
   j892th39gSAHGy329hggeZHDg89hegZGDSHY0==
   -----END CERTIFICATE-----




The CA certificate. Available at CA site.
3. Use it.
 Normal EmailMessage usage
 from django.core.mail import EmailMessage

 msg = EmailMessage(
             subject, message_body, sender, recipient_list,
             attachments=attachments)
 msg.send()



SignedEmailMessage usage

  from SEM import SEMail

  msg = SEMail.SignedEmailMessage(
              subject, message_body, sender, recipient_list,
              attachments=attachments,
              from_key=from_key, from_cert=from_cert)
  msg.send()

More Related Content

Similar to Django SEM

Similar to Django SEM (20)

Dirty Little Secrets They Didn't Teach You In Pentest Class v2
Dirty Little Secrets They Didn't Teach You In Pentest Class v2Dirty Little Secrets They Didn't Teach You In Pentest Class v2
Dirty Little Secrets They Didn't Teach You In Pentest Class v2
 
Dirty Little Secrets They Didn't Teach You In Pentest Class v2
Dirty Little Secrets They Didn't Teach You In Pentest Class v2Dirty Little Secrets They Didn't Teach You In Pentest Class v2
Dirty Little Secrets They Didn't Teach You In Pentest Class v2
 
Best Practices of IoT in the Cloud
Best Practices of IoT in the CloudBest Practices of IoT in the Cloud
Best Practices of IoT in the Cloud
 
hackcon2013-Dirty Little Secrets They Didn't Teach You In Pentesting Class v2
hackcon2013-Dirty Little Secrets They Didn't Teach You In Pentesting Class v2hackcon2013-Dirty Little Secrets They Didn't Teach You In Pentesting Class v2
hackcon2013-Dirty Little Secrets They Didn't Teach You In Pentesting Class v2
 
Steam Learn: HTTPS and certificates explained
Steam Learn: HTTPS and certificates explainedSteam Learn: HTTPS and certificates explained
Steam Learn: HTTPS and certificates explained
 
Best Practices for IoT Security in the Cloud
Best Practices for IoT Security in the CloudBest Practices for IoT Security in the Cloud
Best Practices for IoT Security in the Cloud
 
Introduction to Cryptography
Introduction to CryptographyIntroduction to Cryptography
Introduction to Cryptography
 
Cisco Connect Ottawa 2018 secure on prem
Cisco Connect Ottawa 2018 secure on premCisco Connect Ottawa 2018 secure on prem
Cisco Connect Ottawa 2018 secure on prem
 
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
AWS re:Invent 2016: Encryption: It Was the Best of Controls, It Was the Worst...
 
Best Practices for IoT Security in the Cloud
Best Practices for IoT Security in the CloudBest Practices for IoT Security in the Cloud
Best Practices for IoT Security in the Cloud
 
Java security
Java securityJava security
Java security
 
What is SSL/TLS, 1-way and 2-way SSL?
What is SSL/TLS, 1-way and 2-way SSL?What is SSL/TLS, 1-way and 2-way SSL?
What is SSL/TLS, 1-way and 2-way SSL?
 
Shameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocolsShameful secrets of proprietary network protocols
Shameful secrets of proprietary network protocols
 
Secure socket layer
Secure socket layerSecure socket layer
Secure socket layer
 
CONFidence 2014: Jakub Kałużny: Shameful secrets of proprietary protocols
CONFidence 2014: Jakub Kałużny: Shameful secrets of proprietary protocolsCONFidence 2014: Jakub Kałużny: Shameful secrets of proprietary protocols
CONFidence 2014: Jakub Kałużny: Shameful secrets of proprietary protocols
 
Secrity project keyvan
Secrity project   keyvanSecrity project   keyvan
Secrity project keyvan
 
[Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things![Wroclaw #8] TLS all the things!
[Wroclaw #8] TLS all the things!
 
[KGC 2010] 게임과 보안, 암호 알고리즘과 프로토콜
[KGC 2010] 게임과 보안, 암호 알고리즘과 프로토콜[KGC 2010] 게임과 보안, 암호 알고리즘과 프로토콜
[KGC 2010] 게임과 보안, 암호 알고리즘과 프로토콜
 
Is your mobile app as secure as you think?
Is your mobile app as secure as you think?Is your mobile app as secure as you think?
Is your mobile app as secure as you think?
 
Hardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiaHardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoia
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Django SEM

  • 1. Django-sem, how to make SignedEmailMessage out of EmailMessage in few simple steps. Jakub Wasielak, 2012
  • 2. Identity verification Why? ● Easier bureaucracy ● Fraud prevention ● Enabling law ● Interpersonal communication
  • 3. Identity verification How? ● Ancient times Mostly verbal verification
  • 4. Identity verification How? ● Ancient times Mostly verbal verification ● Middle Ages Sealing wax
  • 5. Identity verification How? ● Ancient times Mostly verbal verification ● Middle Ages Sealing wax ● Before internet Stamps
  • 6. Identity verification How? ● Ancient times Mostly verbal verification ● Middle Ages Sealing wax ● Before internet Stamps ● Now S/MIME
  • 7. Public-key infrastructure Creating, managing, using, storing, and revoking Digital Certificates.
  • 8. Public-key infrastructure All the stuff connected with Digital Certificates.
  • 9. Public-key infrastructure All the stuff connected with Digital Certificates. CA – Certificate Authority – the unit capable of issuing and verifying the digital certificates.
  • 10. Digital Certificate X.509 (PKI) ● Signature Algorithm – selected by CA ● Issuer – CA itself ● Subject – your data ● Subject Public Key – your public key ● Certificate signature – the actual signature ● Version, Serial Number, Validity
  • 11. Digital Certificate Certificate: Data: Version: 1 (0x0) Serial Number: 7829 (0x1e95) Signature Algorithm: md5WithRSAEncryption Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com Validity Not Before: Jul 9 16:04:02 1998 GMT Not After : Jul 9 16:04:02 1999 GMT Subject: C=US, ST=Maryland, L=Pasadena, O=Brent Baccala, OU=FreeSoft, CN=www.freesoft.org/emailAddress=baccala@freesoft.org Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (1024 bit) Modulus (1024 bit): 00:b4:31:98:0a:c4:bc:62:c1:88:aa:dc:b0:c8:bb: ... e8:35:1c:9e:27:52:7e:41:8f Exponent: 65537 (0x10001) Signature Algorithm: md5WithRSAEncryption 93:5f:8f:5f:c5:af:bf:0a:ab:a5:6d:fb:24:5f:b6:59:5d:9d: ... 8f:0e:fc:ba:1f:34:e9:96:6e:6c:cf:f2:ef:9b:bf:de:b5:22
  • 12. Signed mail in Thunderbird
  • 13. Signed mail in Outlook
  • 14. Signed mail in some apple client
  • 15. Signed mail in Gmail ?
  • 16. Signing – first steps MeTooCrypto: M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH, HMACs, message digests, symmetric ciphers, SSL functionality, HTTPS, urllib, xmlrpclib, HMAC'ing AuthCookies, FTP/TLS, S/MIME, ZserverSSL and ZSmime.
  • 17. Signing – first steps MeTooCrypto: M2Crypto is not well documented.
  • 18. SignedEmailMessage – a week later 1. Add 'SEM' into INSTALLED_APPS. 2. Add DEFAULT_CHARSET and AUTH_CERT into setting. 3. Use it.
  • 19. 1. Add 'SEM' into INSTALLED_APPS. pip install django-sem INSTALLED_APPS = ( ... 'SEM', ... )
  • 20. 2. Add DEFAULT_CHARSET and AUTH_CERT into setting. DEFAULT_CHARSET = 'utf-8' AUTH_CERT = "resources/cert.pem" /resources/cert.pem -----BEGIN CERTIFICATE----- AGSJGAS34BDS4htg0234gADSG923ng92G3h2tgjs9afgf ... ... j892th39gSAHGy329hggeZHDg89hegZGDSHY0== -----END CERTIFICATE----- The CA certificate. Available at CA site.
  • 21. 3. Use it. Normal EmailMessage usage from django.core.mail import EmailMessage msg = EmailMessage( subject, message_body, sender, recipient_list, attachments=attachments) msg.send() SignedEmailMessage usage from SEM import SEMail msg = SEMail.SignedEmailMessage( subject, message_body, sender, recipient_list, attachments=attachments, from_key=from_key, from_cert=from_cert) msg.send()