Package org.conscrypt
Class OpenSSLMessageDigestJDK
java.lang.Object
java.security.MessageDigestSpi
org.conscrypt.OpenSSLMessageDigestJDK
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
OpenSSLMessageDigestJDK.MD5,OpenSSLMessageDigestJDK.SHA1,OpenSSLMessageDigestJDK.SHA224,OpenSSLMessageDigestJDK.SHA256,OpenSSLMessageDigestJDK.SHA384,OpenSSLMessageDigestJDK.SHA512
Implements the JDK MessageDigest interface using OpenSSL's EVP API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic final classstatic final classstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final NativeRef.EVP_MD_CTXprivate booleanWhether the digest struct has been initialized inside EVP_MD_CTX.private final longHolds the EVP_MD for the hashing algorithm, e.g.private final byte[]Holds a dummy buffer for writing single bytes to the digest.private final intHolds the output size of the message digest. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateOpenSSLMessageDigestJDK(long evp_md, int size) Creates a new OpenSSLMessageDigest instance for the given algorithm name.privateOpenSSLMessageDigestJDK(long evp_md, int size, NativeRef.EVP_MD_CTX ctx, boolean digestInitializedInContext) -
Method Summary
Modifier and TypeMethodDescriptionclone()protected byte[]protected intprotected voidprotected voidengineUpdate(byte input) protected voidengineUpdate(byte[] input, int offset, int len) protected voidengineUpdate(ByteBuffer input) private voidMethods inherited from class java.security.MessageDigestSpi
engineDigest
-
Field Details
-
ctx
-
evp_md
private final long evp_mdHolds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1"); -
size
private final int sizeHolds the output size of the message digest. -
singleByte
private final byte[] singleByteHolds a dummy buffer for writing single bytes to the digest. -
digestInitializedInContext
private boolean digestInitializedInContextWhether the digest struct has been initialized inside EVP_MD_CTX.
-
-
Constructor Details
-
OpenSSLMessageDigestJDK
Creates a new OpenSSLMessageDigest instance for the given algorithm name.- Throws:
NoSuchAlgorithmException
-
OpenSSLMessageDigestJDK
private OpenSSLMessageDigestJDK(long evp_md, int size, NativeRef.EVP_MD_CTX ctx, boolean digestInitializedInContext)
-
-
Method Details
-
ensureDigestInitializedInContext
private void ensureDigestInitializedInContext() -
engineReset
protected void engineReset()- Specified by:
engineResetin classMessageDigestSpi
-
engineGetDigestLength
protected int engineGetDigestLength()- Overrides:
engineGetDigestLengthin classMessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte input) - Specified by:
engineUpdatein classMessageDigestSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len) - Specified by:
engineUpdatein classMessageDigestSpi
-
engineUpdate
- Overrides:
engineUpdatein classMessageDigestSpi
-
engineDigest
protected byte[] engineDigest()- Specified by:
engineDigestin classMessageDigestSpi
-
clone
- Overrides:
clonein classMessageDigestSpi
-