In the next few chapters, we’ll discuss the engine classes that are part of the core Java API. All engine classes share a similar architecture that we’ll discuss here.
Most programmers are only interested in using the engine classes to perform their desired operation; each engine class has a public interface that defines the operations the engine can perform. None of this is unusual: it is the basis of programming in Java.
However, the engine classes are designed so that users can employ third-party security providers (using the architecture we’ve just examined). For programmers who are interested in writing such providers, the engine classes have an additional interface called the security provider interface (SPI). The SPI is a set of abstract methods that a particular engine must implement in order to fulfill its contract of providing a particular operation.
The role of the SPI has changed between Java 1.1 and Java 1.2. In 1.1, the SPI was simply a convention. There were a set of protected, usually abstract, methods in each engine that made up the SPI. By convention, these methods begin with the word “engine”; implementing a 1.1 engine is a matter of implementing each of these protected methods.
In 1.2, the interface of an engine was split between two distinct
classes: the engine class itself and the SPI class. For example, in
1.2 there is an engine class called
MessageDigest, and its SPI class is called
MessageDigestSpi. For historic reasons, ...