public class SSLUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
setNoValidate(HttpsURLConnection connection)
Changes the HTTPS connection so that it will not validate the endpoint's
certificates.
|
static void |
setNoValidate(HttpsURLConnection connection,
String[] acceptedIssuers)
Changes the HTTPS connection so that it will not validate the endpoint's
certificates.
|
public static void setNoValidate(HttpsURLConnection connection, String[] acceptedIssuers)
connection
object.
This method is equivalent to --no-check-certificate option when
using the Unix/Linux wget command line tool.
As an additional feature the issuer of the certificate can be checked to match (any of) a certain string. If - for example - you create a self-signed certificate then you decide the 'issuer organization' yourself and the issuer organization name you used when you created the certificate can then be validated here. This provides a little extra security than simply accepting any type of certificate.
connection - connection to change (must not yet be connected)acceptedIssuers - accept only a certificate from one of these issuer
organizations. Checks against the Organization (O) field in the 'Issued
By' section of the server's certficate. This parameter provides some
minimal security. A null means all issuer organizations are
accepted.public static void setNoValidate(HttpsURLConnection connection)
connection
object.
This method is equivalent to --no-check-certificate option when
using the Unix/Linux wget command line tool.
connection - connection to change (must not yet be connected)Copyright © 2015 Addicticks. All rights reserved.