Chapter 9. Writing a Provider

If you can’t find a cryptographic provider that implements the algorithms you want to use, it may be worth your while to write your own provider. A cryptographic provider is just a collection of classes that implement cryptographic algorithms—signatures, ciphers, or message digests. One of the classes, which will be a subclass of java.security.Provider , maps algorithm names to class names. The Provider subclass represents the provider as a whole. When you give an algorithm name to a getInstance() method, it is this class that figures out what type of object will be returned.

In this chapter, we’ll develop a provider and several classes that implement the ElGamal cipher and signature algorithms. First, we’ll look at a very simple cryptographic provider. Next, I’ll introduce the ElGamal algorithms and show how the provider can accommodate them. In the remainder of the chapter, I’ll show the code for the ElGamal key pair generation, signatures, and ciphers. If you’re interested only in learning how to create your own provider, just read the beginning of this chapter.

Get Java Cryptography now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.