that we’ve seen how to use the
Signature class, we’ll look at how to implement our own class.
The techniques we’ll see here should be very familiar from our
other examples of implementing an engine in the security provider
architecture. In particular, since in 1.2 the
Signature class extends its own SPI, we can
implement a single class that extends the
To construct our subclass, we must use the following constructor:
This is the only constructor of the
class, so all subclasses of this class must use this constructor. The
string passed to the constructor is the name that will be registered
with the security provider.
Once we’ve constructed our engine object, we must implement the following methods in it:
Initialize the object to prepare it to verify a digital signature. If
the public key does not support the correct algorithm or is otherwise
InvalidKeyException is thrown.
Initialize the object to prepare it to create a digital signature. If
the private key does not support the correct algorithm or is
otherwise corrupted, an
Add the given bytes to the data that is being accumulated for the signature. These methods are called by ...