public final class TlsServerCredentials extends ServerCredentials
incomprehensible()
 method. Unless overridden by a Feature, server identity is provided via getCertificateChain(), getPrivateKey(), and getPrivateKeyPassword().| Modifier and Type | Class and Description | 
|---|---|
static class  | 
TlsServerCredentials.Builder
Builder for  
TlsServerCredentials. | 
static class  | 
TlsServerCredentials.ClientAuth
The level of authentication the server should expect from the client. 
 | 
static class  | 
TlsServerCredentials.Feature
Features to understand TLS configuration. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static ServerCredentials | 
create(File certChain,
      File privateKey)
Creates an instance using provided certificate chain and private key. 
 | 
static ServerCredentials | 
create(InputStream certChain,
      InputStream privateKey)
Creates an instance using provided certificate chain and private key. 
 | 
byte[] | 
getCertificateChain()
The certificate chain for the server's identity, as a new byte array. 
 | 
TlsServerCredentials.ClientAuth | 
getClientAuth()
Non- 
null setting indicating whether the server should expect a client's identity. | 
List<KeyManager> | 
getKeyManagers()
Returns the key manager list which provides the server's identity. 
 | 
byte[] | 
getPrivateKey()
The private key for the server's identity, as a new byte array. 
 | 
String | 
getPrivateKeyPassword()
Returns the password to decrypt the private key, or  
null if unencrypted. | 
byte[] | 
getRootCertificates()
Root trust certificates for verifying the client's identity that override the system's
 defaults. 
 | 
List<TrustManager> | 
getTrustManagers()
Returns the trust manager list which verifies the client's identity. 
 | 
Set<TlsServerCredentials.Feature> | 
incomprehensible(Set<TlsServerCredentials.Feature> understoodFeatures)
Returns an empty set if this credential can be adequately understood via
 the features listed, otherwise returns a hint of features that are lacking
 to understand the configuration to be used for manual debugging. 
 | 
static TlsServerCredentials.Builder | 
newBuilder()
Creates a builder for changing default configuration. 
 | 
public static ServerCredentials create(File certChain, File privateKey) throws IOException
IOExceptionpublic static ServerCredentials create(InputStream certChain, InputStream privateKey) throws IOException
The streams will not be automatically closed.
IOExceptionpublic byte[] getCertificateChain()
null, some feature is providing key manager information via a different
 method.public byte[] getPrivateKey()
getPrivateKeyPassword() is the decryption key. If unencrypted, the
 password will be null. If null, some feature is providing key manager
 information via a different method.public String getPrivateKeyPassword()
null if unencrypted.public List<KeyManager> getKeyManagers()
X509KeyManager. Only a single entry for a type
 is used. Entries earlier in the list are higher priority. If null, key manager
 information is provided via a different method.public TlsServerCredentials.ClientAuth getClientAuth()
null setting indicating whether the server should expect a client's identity.public byte[] getRootCertificates()
public List<TrustManager> getTrustManagers()
X509TrustManager. Only a single entry
 for a type is used. Entries earlier in the list are higher priority. If null, trust
 manager information is provided via the system's default or a different method.public Set<TlsServerCredentials.Feature> incomprehensible(Set<TlsServerCredentials.Feature> understoodFeatures)
An "understood" feature does not imply the caller is able to fully handle the feature. It simply means the caller understands the feature enough to use the appropriate APIs to read the configuration. The caller may support just a subset of a feature, in which case the caller would need to look at the configuration to determine if only the supported subset is used.
This method may not be as simple as a set difference. There may be multiple features that can independently satisfy a piece of configuration. If the configuration is incomprehensible, all such features would be returned, even though only one may be necessary.
An empty set does not imply that the credentials are fully understood. There may be optional configuration that can be ignored if not understood.
Since Feature is an enum, understoodFeatures
 should generally be an EnumSet. understoodFeatures will not be modified.
understoodFeatures - the features understood by the callerpublic static TlsServerCredentials.Builder newBuilder()