diff -r 0875007901f7 -r 18c0f074ed97 jdk/src/java.base/share/classes/java/security/MessageDigest.java --- a/jdk/src/java.base/share/classes/java/security/MessageDigest.java Wed Jul 05 22:19:47 2017 +0200 +++ b/jdk/src/java.base/share/classes/java/security/MessageDigest.java Tue Oct 11 00:04:35 2016 +0000 @@ -32,10 +32,13 @@ import java.io.PrintStream; import java.io.InputStream; import java.io.ByteArrayInputStream; - +import java.security.InvalidKeyException; import java.nio.ByteBuffer; import sun.security.util.Debug; +import sun.security.util.MessageDigestSpi2; + +import javax.crypto.SecretKey; /** * This MessageDigest class provides applications the functionality of a @@ -548,7 +551,7 @@ * and its original parent (Object). */ - static class Delegate extends MessageDigest { + static class Delegate extends MessageDigest implements MessageDigestSpi2 { // The provider implementation (delegate) private MessageDigestSpi digestSpi; @@ -601,6 +604,14 @@ digestSpi.engineUpdate(input); } + public void engineUpdate(SecretKey key) throws InvalidKeyException { + if (digestSpi instanceof MessageDigestSpi2) { + ((MessageDigestSpi2)digestSpi).engineUpdate(key); + } else { + throw new UnsupportedOperationException + ("Digest does not support update of SecretKey object"); + } + } protected byte[] engineDigest() { return digestSpi.engineDigest(); }