JDK-8153948 : sun/security/mscapi/ShortRSAKey1024.sh fails with "Field length overflow"
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-04-11
  • Updated: 2017-06-30
  • Resolved: 2016-07-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9
7u121Fixed 8u112Fixed 9 b126Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
sun/security/mscapi/ShortRSAKey1024.sh

Fails at Windows with "Field length overflow".
At the same machine, test pass with build 112, but start failing with build 113 (and failure reproducible)

#section:shell
----------messages:(3/139)----------
command: shell ShortRSAKey1024.sh 1024
reason: User specified action: run shell ShortRSAKey1024.sh 1024 
elapsed time (seconds): 43.832
----------System.out:(17/750)----------
Removing the keypair if it already exists (for unknown reason)...
Command line args: [-delete, -storetype, Windows-My, -debug, -alias, 7106773.1024]
keytool error: java.lang.Exception: Alias <7106773.1024> does not exist
Creating a temporary RSA keypair in the Windows-My store...
Command line args: [-genkeypair, -storetype, Windows-My, -keyalg, RSA, -alias, 7106773.1024, -keysize, 1024, -dname, cn=localhost,c=US, -debug, -noprompt]

Running the test...
Loaded keystore: Windows-MY
Loaded entry: 7106773.1024
serverPort = 59784
Loaded keystore: Windows-MY
client also threw:


Removing the temporary RSA keypair from the Windows-My store...
Command line args: [-delete, -storetype, Windows-My, -debug, -alias, 7106773.1024]
Done.
----------System.err:(57/4751)*----------
Exception in thread "main" java.lang.Exception: Alias <7106773.1024> does not exist
	at sun.security.tools.keytool.Main.doDeleteEntry(java.base@9-ea/Main.java:1411)
	at sun.security.tools.keytool.Main.doCommands(java.base@9-ea/Main.java:1002)
	at sun.security.tools.keytool.Main.run(java.base@9-ea/Main.java:376)
	at sun.security.tools.keytool.Main.main(java.base@9-ea/Main.java:369)
C:\\Users\\aurora\\sandbox_keepme\\testbase\\jdk\\test\\sun\\security\\mscapi\\ShortRSAKeyWithinTLS.java:29: warning: KeyUtil is internal proprietary API and may be removed in a future release
import sun.security.util.KeyUtil;
                        ^
C:\\Users\\aurora\\sandbox_keepme\\testbase\\jdk\\test\\sun\\security\\mscapi\\ShortRSAKeyWithinTLS.java:175: warning: KeyUtil is internal proprietary API and may be removed in a future release
            int privateKeySize = KeyUtil.getKeySize(privateKey);
                                 ^
C:\\Users\\aurora\\sandbox_keepme\\testbase\\jdk\\test\\sun\\security\\mscapi\\ShortRSAKeyWithinTLS.java:181: warning: KeyUtil is internal proprietary API and may be removed in a future release
            int publicKeySize = KeyUtil.getKeySize(publicKey);
                                ^
3 warnings
Client died...
javax.net.ssl.SSLException: Received fatal alert: internal_error
	at sun.security.ssl.Alerts.getSSLException(java.base@9-ea/Alerts.java:214)
	at sun.security.ssl.Alerts.getSSLException(java.base@9-ea/Alerts.java:159)
	at sun.security.ssl.SSLSocketImpl.recvAlert(java.base@9-ea/SSLSocketImpl.java:2021)
	at sun.security.ssl.SSLSocketImpl.processInputRecord(java.base@9-ea/SSLSocketImpl.java:1189)
	at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-ea/SSLSocketImpl.java:1056)
	at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-ea/SSLSocketImpl.java:955)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(java.base@9-ea/SSLSocketImpl.java:1382)
	at sun.security.ssl.SSLSocketImpl.writeRecord(java.base@9-ea/SSLSocketImpl.java:715)
	at sun.security.ssl.AppOutputStream.write(java.base@9-ea/AppOutputStream.java:67)
	at sun.security.ssl.AppOutputStream.write(java.base@9-ea/AppOutputStream.java:81)
	at ShortRSAKeyWithinTLS.doClientSide(ShortRSAKeyWithinTLS.java:159)
	at ShortRSAKeyWithinTLS$2.run(ShortRSAKeyWithinTLS.java:332)
Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Field length overflow, the field length (83031) should be less than 65536
	at sun.security.ssl.Alerts.getSSLException(java.base@9-ea/Alerts.java:214)
	at sun.security.ssl.SSLSocketImpl.fatal(java.base@9-ea/SSLSocketImpl.java:1949)
	at sun.security.ssl.SSLSocketImpl.fatal(java.base@9-ea/SSLSocketImpl.java:1901)
	at sun.security.ssl.SSLSocketImpl.handleException(java.base@9-ea/SSLSocketImpl.java:1884)
	at sun.security.ssl.SSLSocketImpl.handleException(java.base@9-ea/SSLSocketImpl.java:1810)
	at sun.security.ssl.AppInputStream.read(java.base@9-ea/AppInputStream.java:173)
	at sun.security.ssl.AppInputStream.read(java.base@9-ea/AppInputStream.java:84)
	at ShortRSAKeyWithinTLS.doServerSide(ShortRSAKeyWithinTLS.java:107)
	at ShortRSAKeyWithinTLS.startServer(ShortRSAKeyWithinTLS.java:318)
	at ShortRSAKeyWithinTLS.<init>(ShortRSAKeyWithinTLS.java:244)
	at ShortRSAKeyWithinTLS.main(ShortRSAKeyWithinTLS.java:226)
Caused by: java.lang.RuntimeException: Field length overflow, the field length (83031) should be less than 65536
	at sun.security.ssl.HandshakeOutStream.checkOverflow(java.base@9-ea/HandshakeOutStream.java:146)
	at sun.security.ssl.HandshakeOutStream.putInt16(java.base@9-ea/HandshakeOutStream.java:97)
	at sun.security.ssl.HandshakeMessage$CertificateRequest.send(java.base@9-ea/HandshakeMessage.java:1826)
	at sun.security.ssl.HandshakeMessage.write(java.base@9-ea/HandshakeMessage.java:153)
	at sun.security.ssl.ServerHandshaker.clientHello(java.base@9-ea/ServerHandshaker.java:1108)
	at sun.security.ssl.ServerHandshaker.processMessage(java.base@9-ea/ServerHandshaker.java:230)
	at sun.security.ssl.Handshaker.processLoop(java.base@9-ea/Handshaker.java:1003)
	at sun.security.ssl.Handshaker.processRecord(java.base@9-ea/Handshaker.java:937)
	at sun.security.ssl.SSLSocketImpl.processInputRecord(java.base@9-ea/SSLSocketImpl.java:1119)
	at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-ea/SSLSocketImpl.java:1056)
	at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-ea/SSLSocketImpl.java:955)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(java.base@9-ea/SSLSocketImpl.java:1382)
	at sun.security.ssl.SSLSocketImpl.bytesInCompletePacket(java.base@9-ea/SSLSocketImpl.java:889)
	at sun.security.ssl.AppInputStream.read(java.base@9-ea/AppInputStream.java:144)
	... 5 more
Comments
Yes, the failure reproducible after JDK-6483657. Without JDK-6483657, test still pass.
14-04-2016

Linking to JDK-6483657, as that was fixed in b113, and that fix was related to MSCAPI. Need to check if that was a factor.
12-04-2016