Java Cryptography: Tools and Techniques (The Book + Code Samples)
Minimum price
Suggested price

Java Cryptography: Tools and Techniques

About the Book

Cryptography is about the security of communications. It provides mechanisms for hiding messages from outside observers, accurately identifying the originators of messages, determining that messages have been delivered safely without tampering, and making it possible to accurately identify both the entities receiving and sending messages when messages are being delivered between different parties.

Over time, in our increasingly connected world, issues related to cryptography and security have increasingly become common in the development of applications and even other APIs. In this environment, Java still maintains its popularity as a language for the development and implementation of Internet applications. While Java has an established API for basic cryptography defined as part of the regular Java runtime, many things that developers generally need to do, such as producing and managing certificates, client credentials, time stamps, and secure messaging are not provided. The Legion of the Bouncy Castle Cryptography APIs were developed to fill a large part of this gap. That said, there is an awful lot to know, and many developers do not get the time to take a sabbatical to brush up on the right security API to use when a security related application arrives on their desk. While falling into fear and panic is always an option, we felt it might be better to provide a book, drawing on our experience, that goes beyond what is commonly available in API documentation. A book that provides some basic real world examples of how to use the APIs and address the questions developers most commonly ask and the issues developers most commonly have trouble with. One with a warm friendly cover, designed to avoid panic, and to help keep the reader focused on the idea of getting a job done. It is our aim that "Java Cryptography: Tools and Techniques" is that book.

  • Share this book

  • Categories

    • Java
    • Cryptography
  • Feedback

    You must own a copy of this Book to access the forums.

    Email the Author(s)

About the Authors

David Hook
David Hook

David Hook is an active developer and co-founder of the Bouncy Castle cryptography project, now in its 23rd year, and has been working with the Java Cryptography APIs since their original publication in the late 1990s. In addition to his development work with Bouncy Castle, David has also given presentations and tutorials on the Java Cryptography framework and on the use of the Bouncy Castle APIs, as well as writing several articles, a previous book "Beginning Cryptography with Java" and the mini-ebook "BC FIPS in 100 Examples". He currently works at Keyfactor supporting the use and development of the Bouncy Castle APIs and has recently lead the "charge" which resulted in a version of the APIs being certified for FIPS 140-2. He is a member of the Association of Computing Machinery and the IEEE.

Jon Eaves
Jon Eaves

Jon has more than 25 years of experience constructing software, he has built software in a wide range of domains, from controlling hardware to payroll systems and the standard consumer centric web applications. Jon is particularly interested in software design and how to influence teams in building good software, the latter which takes up more and more of his time. 

On most days you will find Jon riding one of his bikes, drinking coffee at the local cafe and being heckled by colleagues as he wistfully remembers the time he spent all day, every day writing code. 

Table of Contents

  • Acknowledgements
  • Introduction
  • Chapter 1: Getting Started, an Overview
    • The Java Provider Architecture
    • Architecture of the Bouncy Castle APIs
    • The Supporting APIs
    • The Bouncy Castle FIPS distribution
    • Installing Bouncy Castle
    • A Word About Entropy
    • Bits of Security
    • Summary
  • Chapter 2: Block and Stream Ciphers
    • The Basics
    • Algorithm Security Strengths
    • Block Ciphers
    • Block Modes
    • Streaming Block Modes
    • Stream Ciphers
    • Cipher Based Input/Output
    • Summary
  • Chapter 3: Message Digests, MACs, HMACs, KDFs, and XOFs
    • Message Digests
    • MACs
    • HMACs
    • Key Derivation Functions
    • Expandable Output Functions
    • Bouncy Castle Calculator Interfaces for Digests and MACs
    • An Application of Digests: Merkle Trees
    • Summary
  • Chapter 4: Authenticated Modes, Key Wrapping, and the SealedObject
    • Setup for the Examples
    • Authenticated Encryption Modes
    • Key Wrapping Algorithms
    • The SealedObject Class
    • Summary
  • Chapter 5: Password Based Key Generation and Key Splitting
    • Password Based Key Generation
    • PKCS5 Scheme 2
    • SCRYPT
    • Other PBKDFs
    • Key Splitting
    • An Implementation of Key Splitting
    • Summary
  • Chapter 6: Signatures
    • Key Pair Generation and Import
    • Digital Signatures
    • Signature Security Strengths
    • The Digital Signature Algorithm
    • DSA with Edwards Curves (EdDSA)
    • DSTU 4145
    • GOST
    • RSA Signature Algorithms
    • SM2
    • Bouncy Castle Calculator Interfaces for Signatures
    • Summary
  • Chapter 7: Key Transport, Key Agreement, and Key Exchange
    • Algorithm Security Strengths
    • Key Transport
    • Key Agreement and Key Exchange
    • Key Confirmation
    • Summary
  • Chapter 8: X.509 Certificates and Attribute Certificates
    • The X.500 Distinguished Name
    • Public Key Certificates
    • Creating a Basic Public Key Certificate
    • Converting an X509CertificateHolder to an X509Certificate
    • The CertificateFactory Class
    • Creating a CA Certificate with Extensions
    • Creating End-Entity Certificates
    • Attribute Certificates
    • Summary
  • Chapter 9: Certificate Revocation and Certificate Paths
    • Certificate Revocation Lists (CRLs)
    • Converting an X509CRLHolder to an X509CRL
    • Obtaining Revocation Information from a Certificate Issuer
    • Online Certificate Status Protocol
    • Certificate Path Validation
    • Summary
  • Chapter 10: Key and Certificate Storage
    • Setup for the Examples
    • Early KeyStore Types: JKS, JCEKS, BKS, and UBER
    • The keytool Command
    • The PKCS12 KeyStore Type
    • The BCFKS/BCSFKS KeyStore Type
    • Summary
  • Chapter 11: Cryptographic Message Syntax, S/MIME, and TSP
    • Cryptographic Message Syntax
    • Data Content
    • SignedData Content
    • EnvelopedData Content
    • S/MIME
    • Things to Watch With JavaMail
    • Time-Stamp Protocol
    • An Application of Time-Stamps: CAdES-T
    • Summary
  • Chapter 12: Certification Requests and Certificate Management
    • PKCS #10 Certification Requests
    • Certificate Request Message Format
    • Certificate Management over CMS
    • Enrolment over Secure Transport
    • Certificate Management Protocol
    • Summary
  • Chapter 13: OpenPGP
    • The Basics
    • Generating Armored Output
    • Generating Key Rings
    • Adding a Sub-Key to an Existing Key Ring
    • Encapsulated Signed Messages
    • Detached Signatures
    • Signing Text Data
    • Cleartext Signatures
    • Public Key Encryption
    • PBE Encryption
    • Keybox Files
    • Using S-expressions for Private Keys
    • Summary
  • Chapter 14: Transport Layer Security
    • Introduction
    • Installation
    • Conventions
    • Some Preparation - a Simple Protocol
    • A Basic TLS Server
    • A Basic TLS Client
    • Using Client-Side Authentication
    • Another Look a TrustManagers
    • Properties
    • BC JSSE Extensions
    • Using the low level (D)TLS API
    • The Low-level TLS API
    • DTLS
    • Low-level TLS API Overrides
    • Specialist Protocols: PSK and SRP
    • Summary
  • Chapter 15: The Future
    • Installing the Bouncy Castle Post-Quantum Provider
    • Stateful Signature Algorithms
    • Stateless Signature Algorithms
    • Key Encapsulation Mechanisms
    • Hybrid Encryption
    • Summary
  • Appendix A: ASN.1 and Bouncy Castle
    • Basic ASN.1 Syntax
    • The Types
    • Encoding Rules
    • Basic Guidance
    • Defining Your Own Objects
  • Appendix B: The Bouncy Castle Kotlin API
    • A Note on Packaging
    • Generating a PKCS#10 Certification Request
    • Generating a Certificate
  • Appendix C: Algorithms provided by the Bouncy Castle Providers
  • Acronyms and Definitions
  • Bibliography and Further Reading
  • Notes

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub