Java Cryptography: Tools and Techniques (The Book + Code Samples)
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.
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, and KDFs
- Message Digests
- MACs
- HMACs
- Key Derivation 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
-
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
- BC JSSE Extensions
- Using the low level (D)TLS API
- The Low-level TLS API
-
Chapter 15: The Future
- Installing the Bouncy Castle Post-Quantum Provider
- Stateful Signature Algorithms
- Stateless Signature Algorithms
- The rest of the Chapter
-
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
Authors have earned$9,907,825writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
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), EPUB (for phones and tablets) and MOBI (for 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
Top Books
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Continuous Delivery Pipelines
Dave FarleyThis practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
C++20
Rainer GrimmC++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
The book is almost daily updated. These incremental updates ease my interaction with the proofreaders.
Atomic Kotlin
Bruce Eckel and Svetlana IsakovaFor both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Introductory Statistics with Randomization and Simulation
Mine Cetinkaya-Rundel, Christopher Barr, OpenIntro, and David DiezA complete foundation for Statistics, also serving as a foundation for Data Science, that introduces inference using randomization and simulation while covering traditional methods.
Leanpub revenue supports OpenIntro, so we can provide free desk copies to teachers interested in using our books in the classroom.
More resources: openintro.org.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Java OOP Done Right
Alan MellorObject Oriented Programming is still a great way to create clean, maintainable code. But only if you use it right.
This book gives you 25 years of OO best practice, ready to use.
You'll learn to design objects behaviour-first, use TDD to help, then confidently apply Design Patterns, SOLID principles and Refactoring to make clean, crafted code.
Introducing EventStorming
Alberto BrandoliniThe deepest tutorial and explanation about EventStorming, straight from the inventor.
Discrete Mathematics for Computer Science
Alexander Shen, Alexander S. Kulikov, Vladimir Podolskii, and Aleksandr GolovnevThis book supplements the DM for CS Specialization at Coursera and contains many interactive puzzles, autograded quizzes, and code snippets. They are intended to help you to discover important ideas in discrete mathematics on your own. By purchasing the book, you will get all updates of the book free of charge when they are released.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #4
Modern C++ by Nicolai Josuttis
2 Books
- #5
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #6
"The C++ Standard Library" and "Concurrency with Modern C++"
2 Books
Get my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library... - #7
Mastering Containers
2 Books
Docker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes! - #8
Modern Management Made Easy
3 Books
Read all three Modern Management Made Easy books. Learn to manage yourself, lead and serve others, and lead the organization. - #9
The Future of Digital Health
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer... - #10
Django for Beginners/APIs/Professionals
3 Books