public enum SslMode extends Enum<SslMode>
| Enum Constant and Description |
|---|
DISABLED
Establish an unencrypted connection.
|
PREFERRED
Establish an encrypted connection if the server supports encrypted connections, otherwise fallback to
an unencrypted connection.
|
REQUIRED
Establish an encrypted connection if the server supports encrypted connections, otherwise the
connection fails.
|
TUNNEL
Establish an encrypted connection based on
VERIFY_CA, additionally perform identity
verification by checking the hostname. |
VERIFY_CA
Establish an encrypted connection based on
REQUIRED with verify the server Certificate
Authority (CA) certificates. |
VERIFY_IDENTITY
Establish an encrypted connection based on
VERIFY_CA, additionally perform identity
verification by checking the hostname. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
requireSsl()
Check if SSL is required.
|
boolean |
startSsl()
Check if need prepare SSL after connection has created.
|
static SslMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SslMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
boolean |
verifyCertificate()
Check if the client will verify the server certificate.
|
boolean |
verifyIdentity()
Check if the client will verify the server certificate and hostname/ip in the certificate.
|
public static final SslMode DISABLED
In other words: I don't care about security and don't want to pay the overhead for encryption.
public static final SslMode PREFERRED
In other words: I don't care about encryption but will pay the overhead of encryption if the server supports it.
public static final SslMode REQUIRED
In other words: I want my data to be encrypted, and I accept the overhead. I trust that the network will make sure I always connect to the server I want.
public static final SslMode VERIFY_CA
REQUIRED with verify the server Certificate
Authority (CA) certificates. The connection attempt fails if CA certificates mismatched.
In other words: I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server that I trust.
public static final SslMode VERIFY_IDENTITY
VERIFY_CA, additionally perform identity
verification by checking the hostname. The connection attempt fails if the identity mismatched.
In other words: I want my data encrypted, and I accept the overhead. I want to be sure that I connect to a server I trust, and that it's the one I specify.
public static final SslMode TUNNEL
VERIFY_CA, additionally perform identity
verification by checking the hostname. The connection attempt fails if the identity mismatched.
In other words: I want to connect to a SSL proxy without using MySQL's SSL protocol.
public static SslMode[] values()
for (SslMode c : SslMode.values()) System.out.println(c);
public static SslMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic final boolean requireSsl()
public final boolean startSsl()
public final boolean verifyCertificate()
public final boolean verifyIdentity()
Copyright © 2018–2023 asyncer.io. All rights reserved.