Top Description Inners Fields Constructors Methods
org.conscrypt

public Class OpenSSLMessageDigestJDK

extends MessageDigestSpi
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
org.conscrypt.OpenSSLMessageDigestJDK.MD5, org.conscrypt.OpenSSLMessageDigestJDK.SHA1, org.conscrypt.OpenSSLMessageDigestJDK.SHA224, org.conscrypt.OpenSSLMessageDigestJDK.SHA256, org.conscrypt.OpenSSLMessageDigestJDK.SHA384, org.conscrypt.OpenSSLMessageDigestJDK.SHA512
Annotations
@Internal
Imports
java.nio.ByteBuffer, java.security.MessageDigestSpi, .NoSuchAlgorithmException

Implements the JDK MessageDigest interface using OpenSSL's EVP API.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private final NativeRef.EVP_MD_CTX
private boolean
digestInitializedInContext

Whether the digest struct has been initialized inside EVP_MD_CTX.

private final long
evp_md

Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1");

private final byte[]
singleByte

Holds a dummy buffer for writing single bytes to the digest.

private final int
size

Holds the output size of the message digest.

Constructor Summary

AccessConstructor and Description
private
OpenSSLMessageDigestJDK(long evp_md, int size)

Creates a new OpenSSLMessageDigest instance for the given algorithm name.

private
OpenSSLMessageDigestJDK(long evp_md, int size, NativeRef.EVP_MD_CTX ctx, boolean digestInitializedInContext)

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.security.MessageDigestSpi.clone.

Returns a clone if the implementation is cloneable.
protected synchronized byte[]
engineDigest()

Implements abstract java.security.MessageDigestSpi.engineDigest.

Completes the hash computation by performing final operations such as padding.
protected int
engineGetDigestLength()

Overrides java.security.MessageDigestSpi.engineGetDigestLength.

Returns the digest length in bytes.
protected synchronized void
engineReset()

Implements abstract java.security.MessageDigestSpi.engineReset.

Resets the digest for further use.
protected synchronized void
engineUpdate(byte
the byte to use for the update.
input
)

Implements abstract java.security.MessageDigestSpi.engineUpdate.

Updates the digest using the specified byte.
protected synchronized void
engineUpdate(byte[]
the array of bytes to use for the update.
input
,
int
the offset to start from in the array of bytes.
offset
,
int
the number of bytes to use, starting at offset.
len
)

Implements abstract java.security.MessageDigestSpi.engineUpdate.

Updates the digest using the specified array of bytes, starting at the specified offset.
protected synchronized void
engineUpdate(ByteBuffer
the ByteBuffer
input
)

Overrides java.security.MessageDigestSpi.engineUpdate.

Update the digest using the specified ByteBuffer.
private synchronized void
Inherited from java.security.MessageDigestSpi:
engineDigest

Field Detail

ctxback to summary
private final NativeRef.EVP_MD_CTX ctx
digestInitializedInContextback to summary
private boolean digestInitializedInContext

Whether the digest struct has been initialized inside EVP_MD_CTX.

evp_mdback to summary
private final long evp_md

Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1");

singleByteback to summary
private final byte[] singleByte

Holds a dummy buffer for writing single bytes to the digest.

sizeback to summary
private final int size

Holds the output size of the message digest.

Constructor Detail

OpenSSLMessageDigestJDKback to summary
private OpenSSLMessageDigestJDK(long evp_md, int size) throws NoSuchAlgorithmException

Creates a new OpenSSLMessageDigest instance for the given algorithm name.

OpenSSLMessageDigestJDKback to summary
private OpenSSLMessageDigestJDK(long evp_md, int size, NativeRef.EVP_MD_CTX ctx, boolean digestInitializedInContext)

Method Detail

cloneback to summary
public Object clone()

Overrides java.security.MessageDigestSpi.clone.

Doc from java.security.MessageDigestSpi.clone.

Returns a clone if the implementation is cloneable.

Returns:Object

a clone if the implementation is cloneable.

Annotations
@Override
engineDigestback to summary
protected synchronized byte[] engineDigest()

Implements abstract java.security.MessageDigestSpi.engineDigest.

Doc from java.security.MessageDigestSpi.engineDigest.

Completes the hash computation by performing final operations such as padding. Once engineDigest has been called, the engine should be reset (see engineReset). Resetting is the responsibility of the engine implementor.

Returns:byte[]

the array of bytes for the resulting hash value.

Annotations
@Override
engineGetDigestLengthback to summary
protected int engineGetDigestLength()

Overrides java.security.MessageDigestSpi.engineGetDigestLength.

Doc from java.security.MessageDigestSpi.engineGetDigestLength.

Returns the digest length in bytes.

This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.)

The default behavior is to return 0.

This method may be overridden by a provider to return the digest length.

Returns:int

the digest length in bytes.

Annotations
@Override
engineResetback to summary
protected synchronized void engineReset()

Implements abstract java.security.MessageDigestSpi.engineReset.

Doc from java.security.MessageDigestSpi.engineReset.

Resets the digest for further use.

Annotations
@Override
engineUpdateback to summary
protected synchronized void engineUpdate(byte input)

Implements abstract java.security.MessageDigestSpi.engineUpdate.

Doc from java.security.MessageDigestSpi.engineUpdate.

Updates the digest using the specified byte.

Parameters
input:byte

the byte to use for the update.

Annotations
@Override
engineUpdateback to summary
protected synchronized void engineUpdate(byte[] input, int offset, int len)

Implements abstract java.security.MessageDigestSpi.engineUpdate.

Doc from java.security.MessageDigestSpi.engineUpdate.

Updates the digest using the specified array of bytes, starting at the specified offset.

Parameters
input:byte[]

the array of bytes to use for the update.

offset:int

the offset to start from in the array of bytes.

len:int

the number of bytes to use, starting at offset.

Annotations
@Override
engineUpdateback to summary
protected synchronized void engineUpdate(ByteBuffer input)

Overrides java.security.MessageDigestSpi.engineUpdate.

Doc from java.security.MessageDigestSpi.engineUpdate.

Update the digest using the specified ByteBuffer. The digest is updated using the input.remaining() bytes starting at input.position(). Upon return, the buffer's position will be equal to its limit; its limit will not have changed.

Parameters
input:ByteBuffer

the ByteBuffer

Annotations
@Override
ensureDigestInitializedInContextback to summary
private synchronized void ensureDigestInitializedInContext()
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.MD5

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
MD5()

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

MD5back to summary
public MD5() throws NoSuchAlgorithmException
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.SHA1

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public
SHA1()

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

SHA1back to summary
public SHA1() throws NoSuchAlgorithmException
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.SHA224

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

SHA224back to summary
public SHA224() throws NoSuchAlgorithmException
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.SHA256

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

SHA256back to summary
public SHA256() throws NoSuchAlgorithmException
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.SHA384

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

SHA384back to summary
public SHA384() throws NoSuchAlgorithmException
org.conscrypt back to summary

public final Class OpenSSLMessageDigestJDK.SHA512

extends OpenSSLMessageDigestJDK
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.conscrypt.OpenSSLMessageDigestJDK:
cloneengineDigestengineGetDigestLengthengineResetengineUpdateengineUpdateengineUpdate

Constructor Detail

SHA512back to summary
public SHA512() throws NoSuchAlgorithmException