Return X509Certificate[] from SSLSession.getPeerCertificates() #199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adjusts
SSLSession.getPeerCertificates()
to return an array of typeX509Certificate
rather thanCertificate
. Previously wolfJSSE created individual array elements asjava.security.cert.X509Certificate
objects, but returned them as ajava.security.cert.Certificate[]
to conform to the Javadoc specification forSSLSession.getPeerCertificates()
:Some callers of this API (for example Postgres) tries to cast this return back to an array of
X509Certificate[]
, such as:This cast will throw an Exception similar to:
This PR adjusts
WolfSSLImplementSSLSession.getPeerCertificates()
to return aX509Certificate[]
from the body of the method, to match SunJSSE behavior. SinceX509Certificate
is a subclass ofCertificate
, this should not break calling applications. Method signature is left intact as returning aCertificate[]
, so we still conform to SSLSession definition in general.