35 lines
890 B
Plaintext
35 lines
890 B
Plaintext
![]() |
== How to fix it in Java Cryptographic Extension
|
||
|
|
||
|
=== Code examples
|
||
|
|
||
|
include::../../common/fix/code-rationale.adoc[]
|
||
|
|
||
|
:cert_method_name: X509TrustManager
|
||
|
|
||
|
include::../../common/fix/code-rationale-override.adoc[]
|
||
|
|
||
|
==== Noncompliant code example
|
||
|
|
||
|
[source,kotlin]
|
||
|
----
|
||
|
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
|
||
|
@Throws(CertificateException::class)
|
||
|
override fun checkClientTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||
|
} // Noncompliant
|
||
|
|
||
|
@Throws(CertificateException::class)
|
||
|
override fun checkServerTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||
|
} // Noncompliant
|
||
|
|
||
|
override fun getAcceptedIssuers(): Array<java.security.cert.X509Certificate> {
|
||
|
return arrayOf()
|
||
|
}
|
||
|
})
|
||
|
----
|
||
|
|
||
|
=== How does this work?
|
||
|
|
||
|
include::../../common/fix/validation.adoc[]
|
||
|
|
||
|
include::../../common/fix/keytool.adoc[]
|