Skip to main content
  • Book
  • © 2019

Practical Cryptography in Python

Learning Correct Cryptography by Example

Apress
  • Teaches you the basics of writing Python programs that use cryptography
  • Offers clear guidance on the correct use of cryptography in a landscape where good advice is hard to come by
  • Provides examples of bad cryptography along with source code that breaks it

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (8 chapters)

  1. Front Matter

    Pages i-xv
  2. Cryptography: More Than Secrecy

    • Seth James Nielson, Christopher K. Monson
    Pages 1-19
  3. Hashing

    • Seth James Nielson, Christopher K. Monson
    Pages 21-52
  4. Symmetric Encryption: Two Sides, One Key

    • Seth James Nielson, Christopher K. Monson
    Pages 53-110
  5. Asymmetric Encryption: Public/Private Keys

    • Seth James Nielson, Christopher K. Monson
    Pages 111-163
  6. Message Integrity, Signatures, and Certificates

    • Seth James Nielson, Christopher K. Monson
    Pages 165-212
  7. Combining Asymmetric and Symmetric Algorithms

    • Seth James Nielson, Christopher K. Monson
    Pages 213-248
  8. More Symmetric Crypto: Authenticated Encryption and Kerberos

    • Seth James Nielson, Christopher K. Monson
    Pages 249-292
  9. TLS Communications

    • Seth James Nielson, Christopher K. Monson
    Pages 293-359
  10. Back Matter

    Pages 361-371

About this book

Develop a greater intuition for the proper use of cryptography. This book teaches the basics of writing cryptographic algorithms in Python, demystifies cryptographic internals, and demonstrates common ways cryptography is used incorrectly.

Cryptography is the lifeblood of the digital world’s security infrastructure. From governments around the world to the average consumer, most communications are protected in some form or another by cryptography. These days, even Google searches are encrypted. Despite its ubiquity, cryptography is easy to misconfigure, misuse, and misunderstand.

Developers building cryptographic operations into their applications are not typically experts in the subject, and may not fully grasp the implication of different algorithms, modes, and other parameters. The concepts in this book are largely taught by example, including incorrect uses of cryptography and how "bad" cryptography can be broken. By digging into the guts of cryptography, you can experience what works, what doesn't, and why.


What You’ll Learn

  • Understand where cryptography is used, why, and how it gets misused
  • Know what secure hashing is used for and its basic properties
  • Get up to speed on algorithms and modes for block ciphers such as AES, and see how bad configurations break
  • Use message integrity and/or digital signatures to protect messages
  • Utilize modern symmetric ciphers such as AES-GCM and CHACHA
  • Practice the basics of public key cryptography, including ECDSA signatures
  • Discover how RSA encryption can be broken if insecure padding is used
  • Employ TLS connections for secure communications
  • Find out how certificates work and modern improvements such as certificate pinning and certificate transparency (CT) logs


Who This Book Is For

IT administrators and software developers familiar with Python. Although readers may have some knowledge of cryptography, the book assumes that the reader is starting from scratch. 

Authors and Affiliations

  • Austin, USA

    Seth James Nielson

  • Hampstead, USA

    Christopher K. Monson

About the authors

Dr. Seth James Nielson is the founder and chief scientist of Crimson Vista, Inc., a boutique computer security research and consulting company. He is also an adjunct professor at Johns Hopkins University where he teaches network security and has also served as the director of advanced research projects at the Information Security Institute. As part of his Hopkins work, he co-founded the cryptodoneright.org knowledge base, through a generous grant from Cisco. 

Christopher K. Monson has a PhD in machine learning, and has spent over a decade at Google in various engineering, machine learning, and leadership roles. He has broad experience writing and teaching programming courses in multiple languages, and has worked in document password recovery, malware detection, and large-scale secure computing. He is currently serving as the chief technology officer at Data Machines Corp. and teaches cloud computing security as a lecturer at the Johns Hopkins University Information Security Institute.

Bibliographic Information

  • Book Title: Practical Cryptography in Python

  • Book Subtitle: Learning Correct Cryptography by Example

  • Authors: Seth James Nielson, Christopher K. Monson

  • DOI: https://doi.org/10.1007/978-1-4842-4900-0

  • Publisher: Apress Berkeley, CA

  • eBook Packages: Professional and Applied Computing, Apress Access Books, Professional and Applied Computing (R0)

  • Copyright Information: Seth James Nielson, Christopher K. Monson 2019

  • Softcover ISBN: 978-1-4842-4899-7Published: 27 September 2019

  • eBook ISBN: 978-1-4842-4900-0Published: 27 September 2019

  • Edition Number: 1

  • Number of Pages: XV, 371

  • Number of Illustrations: 39 b/w illustrations

  • Topics: Security, Python

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access