
* Modify JVM Crypto rules: Change title * changed names * Apply suggestions from code review * fixed includes
35 lines
889 B
Plaintext
35 lines
889 B
Plaintext
== How to fix it in Java Cryptography 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[]
|