diff -r 78a1749a43e2 -r d0ed88d92afe jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java --- a/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java Thu Apr 11 17:57:08 2013 +0100 +++ b/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java Thu Apr 11 18:00:23 2013 +0100 @@ -101,7 +101,7 @@ int keyLength = keySpec.getKeyLength(); if (keyLength == 0) { throw new InvalidKeySpecException("Key length not found"); - } else if (keyLength == 0) { + } else if (keyLength < 0) { throw new InvalidKeySpecException("Key length is negative"); } try {