public class SHA256Spi
extends java.security.MessageDigestSpi
implements java.lang.Cloneable
Some versions of JSSE (e.g. Java 11) may contain a bug (https://bugs.openjdk.java.net/browse/JDK-8214098) that may cause
a TLS handshake to fail with an UnsupportedOperationException if an MessageDigest
engine is used that implements the Cloneable interface and is extended from the
java.security.MessageDigest
class.
This class belongs to the "subsidiary" IAIK-MD
provider and wraps around the SHA-256 MessageDigest implementation of the
IAIK
provider but is extended from the
MessageDigestSpi class and therefore allows to use the IAIK provider with
affected JSSE versions when installing the IAIK-MD
provider
as first provider in front of the IAIK provider:
Security.insertProviderAt(new IAIKMD(), 1); Security.insertProviderAt(new IAIK(), 2);
SHA256
Constructor and Description |
---|
SHA256Spi()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this message digest that can be used independently
of this instance.
|
protected byte[] |
engineDigest()
Finishes the message digest computation.
|
protected void |
engineReset()
Resets this MessageDigest engine.
|
protected void |
engineUpdate(byte input)
Updates the message digest computation with the given data byte.
|
protected void |
engineUpdate(byte[] input,
int offset,
int len)
Updates the message digest computation with the given data.
|
public SHA256Spi()
Shall not be used by application. Applications shall use
MessageDigest.getInstance()
for creating a MessageDigest
engine and shall use the MessageDigest engines of the
IAIK
provider:
MessageDigest md = MessageDigest.getInstance("SHA-256", "IAIK");
public java.lang.Object clone()
protected void engineUpdate(byte input)
engineUpdate
in class java.security.MessageDigestSpi
input
- the data byteprotected void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class java.security.MessageDigestSpi
input
- the input dataoffset
- the start offset in the input arraylen
- the len of the dataprotected byte[] engineDigest()
engineDigest
in class java.security.MessageDigestSpi
protected void engineReset()
engineReset
in class java.security.MessageDigestSpi