public class SslDomainImpl extends java.lang.Object implements SslDomain, ProtonSslEngineProvider, ProtonJSslDomain
SslDomain.Factory, SslDomain.Mode, SslDomain.VerifyMode
Constructor and Description |
---|
SslDomainImpl()
Application code should use
SslDomain.Factory.create() instead. |
Modifier and Type | Method and Description |
---|---|
boolean |
allowUnsecuredClient() |
void |
allowUnsecuredClient(boolean allowUnsecured)
Permit a server to accept connection requests from non-SSL clients.
|
ProtonSslEngine |
createSslEngine(SslPeerDetails peerDetails)
Returns an SSL engine.
|
java.lang.String |
getCertificateFile() |
SslDomain.Mode |
getMode() |
SslDomain.VerifyMode |
getPeerAuthentication() |
java.lang.String |
getPrivateKeyFile() |
java.lang.String |
getPrivateKeyPassword() |
javax.net.ssl.SSLContext |
getSslContext()
Returns the SSLContext set by
SslDomain.setSslContext(SSLContext) . |
java.lang.String |
getTrustedCaDb() |
void |
init(SslDomain.Mode mode)
Initialize the ssl domain object.
|
void |
setCredentials(java.lang.String certificateFile,
java.lang.String privateKeyFile,
java.lang.String privateKeyPassword)
Set the certificate that identifies the local node to the remote.
|
void |
setPeerAuthentication(SslDomain.VerifyMode verifyMode)
Configure the level of verification used on the peer certificate.
|
void |
setSslContext(javax.net.ssl.SSLContext sslContext)
Sets an SSLContext for use when establishing SSL transport.
|
void |
setTrustedCaDb(java.lang.String certificateDb)
Configure the set of trusted CA certificates used by this node to verify peers.
|
java.lang.String |
toString() |
public SslDomainImpl()
SslDomain.Factory.create()
instead.public void init(SslDomain.Mode mode)
SslDomain
public SslDomain.Mode getMode()
public void setCredentials(java.lang.String certificateFile, java.lang.String privateKeyFile, java.lang.String privateKeyPassword)
SslDomain
setCredentials
in interface SslDomain
certificateFile
- path to file/database containing the identifying
certificate.privateKeyFile
- path to file/database containing the private key used to
sign the certificateprivateKeyPassword
- the password used to sign the key, else null if key is not
protected.public void setTrustedCaDb(java.lang.String certificateDb)
SslDomain
setTrustedCaDb
in interface SslDomain
certificateDb
- database of trusted CAs, used to authenticate the peer.public java.lang.String getTrustedCaDb()
getTrustedCaDb
in interface SslDomain
public void setSslContext(javax.net.ssl.SSLContext sslContext)
SslDomain
setSslContext
in interface SslDomain
sslContext
- the context to usepublic javax.net.ssl.SSLContext getSslContext()
SslDomain
SslDomain.setSslContext(SSLContext)
.getSslContext
in interface SslDomain
public void setPeerAuthentication(SslDomain.VerifyMode verifyMode)
SslDomain
SslDomain.VerifyMode.ANONYMOUS_PEER
).
Once certificates and trusted CAs are configured, peer verification can be enabled.
In order to verify a peer, a trusted CA must be configured. See
SslDomain.setTrustedCaDb(String)
.
NOTE: Servers must provide their own certificate when verifying a peer. See
SslDomain.setCredentials(String, String, String)
).setPeerAuthentication
in interface SslDomain
verifyMode
- the level of validation to apply to the peerpublic SslDomain.VerifyMode getPeerAuthentication()
getPeerAuthentication
in interface SslDomain
public java.lang.String getPrivateKeyFile()
getPrivateKeyFile
in interface SslDomain
public java.lang.String getPrivateKeyPassword()
getPrivateKeyPassword
in interface SslDomain
public java.lang.String getCertificateFile()
getCertificateFile
in interface SslDomain
public void allowUnsecuredClient(boolean allowUnsecured)
SslDomain
allowUnsecuredClient
in interface SslDomain
public boolean allowUnsecuredClient()
allowUnsecuredClient
in interface SslDomain
public ProtonSslEngine createSslEngine(SslPeerDetails peerDetails)
ProtonSslEngineProvider
createSslEngine
in interface ProtonSslEngineProvider
peerDetails
- the details of the remote peer. If non-null, may be used to assist SSL session resumption.public java.lang.String toString()
toString
in class java.lang.Object