Summary
-------
Remove the deprecated javax.security.cert APIs.
Problem
-------
The legacy javax.security.cert APIs and the dependent APIs were initially deprecated in Java SE 9 and targeted for removal in Java SE 13. Delays pushed the removal target to JDK 19. Applications should migrate the java.security.cert APIs.
We included the javax.security.cert in JDK 1.4 (circa 2002) due to backwards compatibility concerns with the unbundled JSSE release for JDK 1.2/1.3, but have always encouraged everyone not to use this API from day 1.
> Note: The classes in the package javax.security.cert exist for compatibility with earlier versions of the Java Secure Sockets Extension (JSSE). New applications should instead use the standard Java SE certificate classes located in java.security.cert.
Solution
--------
Remove the deprecated javax.security.cert APIs and public APIs that depends on them.
Specification
-------------
The javax.security.cert package will be removed, which include the following classes:
- Certificate
- CertificateEncodingException
- CertificateException
- CertificateExpiredException
- CertificateNotYetValidException
- CertificateParsingException
- X509Certificate
The following methods that depend on javax.security.cert will be removed:
> javax.net.ssl.HandshakeCompletedEvent.getPeerCertificateChain()
-
- /**
- * Returns the identity of the peer which was identified as part
- * of defining the session.
- * Note: This method can be used only when using certificate-based
- * cipher suites; using it with non-certificate-based cipher suites,
- * such as Kerberos, will throw an SSLPeerUnverifiedException.
- * <P>
- * Note: The returned value may not be a valid certificate chain
- * and should not be relied on for trust decisions.
- *
- * <p><em>Note: this method exists for compatibility with previous
- * releases. New applications should use
- * {@link #getPeerCertificates} instead.</em></p>
- *
- * @return an ordered array of peer X.509 certificates,
- * with the peer's own certificate first followed by any
- * certificate authorities. (The certificates are in
- * the original JSSE
- * {@link javax.security.cert.X509Certificate} format).
- * @exception SSLPeerUnverifiedException if the peer is not verified.
- * @see #getPeerPrincipal()
- * @deprecated The {@link #getPeerCertificates()} method that returns an
- * array of {@code java.security.cert.Certificate} should
- * be used instead.
- */
- @SuppressWarnings("removal")
- @Deprecated(since="9", forRemoval=true)
- public javax.security.cert.X509Certificate [] getPeerCertificateChain()
- throws SSLPeerUnverifiedException
- {
- return session.getPeerCertificateChain();
- }
> javax.net.ssl.SSLSession.getPeerCertificateChain()
- /**
- * Returns the identity of the peer which was identified as part
- * of defining the session.
- * <P>
- * Note: This method can be used only when using certificate-based
- * cipher suites; using it with non-certificate-based cipher suites,
- * such as Kerberos, will throw an SSLPeerUnverifiedException.
- * <P>
- * Note: The returned value may not be a valid certificate chain
- * and should not be relied on for trust decisions.
- *
- * <p><em>Note: this method exists for compatibility with previous
- * releases. New applications should use
- * {@link #getPeerCertificates} instead.</em></p>
- *
- * @return an ordered array of peer X.509 certificates,
- * with the peer's own certificate first followed by any
- * certificate authorities. (The certificates are in
- * the original JSSE certificate
- * {@link javax.security.cert.X509Certificate} format.)
- * @exception SSLPeerUnverifiedException if the peer's identity
- * has not been verified
- * @see #getPeerPrincipal()
- * @deprecated The {@link #getPeerCertificates()} method that returns an
- * array of {@code java.security.cert.Certificate} should
- * be used instead.
- */
- @SuppressWarnings("removal")
- @Deprecated(since="9", forRemoval=true)
- public javax.security.cert.X509Certificate [] getPeerCertificateChain()
- throws SSLPeerUnverifiedException;
-