22 lines
638 B
Plaintext
22 lines
638 B
Plaintext
include::../description.adoc[]
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
ServicePointManager.ServerCertificateValidationCallback =
|
|
Function(sender, certificate, chain, errors) True ' Noncompliant: trust all certificates
|
|
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
ServicePointManager.ServerCertificateValidationCallback =
|
|
Function(sender, certificate, chain, errors)
|
|
If Development Then Return True ' For development, trust all certificates
|
|
Return Errors = SslPolicyErrors.None AndAlso ValidCerts.Contains(certificate.GetCertHashString()) ' Compliant: trust only some certificates
|
|
End Function
|
|
----
|
|
|
|
include::../see.adoc[]
|