public class DTLSContextBuilder extends Object
| Constructor and Description |
|---|
DTLSContextBuilder()
Creates an DTLS context builder with default protocol TLS 1.2.
|
DTLSContextBuilder(String protocol)
Creates an DTLS context builder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClientKey(byte[] privateKey,
InputStream certificate)
Adds the given client key and the associated self-signed certificate.
|
void |
addClientKey(byte[] privateKey,
InputStream certificate,
InputStream... certificationChain)
Adds the given client key and the associated certificate and certification chain to the key store.
|
void |
addClientKey(InputStream privateKey,
InputStream certificate)
Adds the given client key and the associated self-signed certificate.
|
void |
addClientKey(InputStream privateKey,
InputStream certificate,
InputStream... certificationChain)
Adds the given client key and the associated certificate and certification chain to the key store.
|
void |
addClientKey(String privateKeyPath,
String certificatePath,
String... certificationChainPaths)
Adds the given client key and the associated certificate and certification chain to the key store.
|
void |
addServerCertificate(InputStream certificate)
Adds the given server certificate to the trust store.
|
void |
addServerCertificate(String certificatePath)
Adds the given server certificate to the trust store.
|
void |
addServerCertificates(String[] trustedCertificates) |
DTLSContext |
build(String keyStorePassword)
Creates an DTLS context using the populated trust store and an the populated key store, using the given key store
password.
|
public DTLSContextBuilder()
throws GeneralSecurityException
GeneralSecurityException - if an exception occurs while initializing the trust store or the key store.public DTLSContextBuilder(String protocol) throws GeneralSecurityException
protocol - DTLS protocol to use.password - keystore password.GeneralSecurityException - if an exception occurs while initializing the trust store or the key store.public void addClientKey(byte[] privateKey,
InputStream certificate)
throws GeneralSecurityException
privateKey - the private key to add.certificate - the associated certificate.GeneralSecurityException - if the certificates could not be loaded or the private key could not be added.public void addClientKey(byte[] privateKey,
InputStream certificate,
InputStream... certificationChain)
throws GeneralSecurityException
privateKey - the private key to add.certificate - the associated certificate.certificationChain - the certification chain, ordered, the root certificate at the end.GeneralSecurityException - if the certificates could not be loaded or the private key could not be added.public void addClientKey(InputStream privateKey, InputStream certificate) throws IOException, GeneralSecurityException
privateKey - the private key to add.certificate - the associated certificate.GeneralSecurityException - if the certificate could not be loaded or the private key could not be added.IOException - if the given privateKey could not be read.public void addClientKey(InputStream privateKey, InputStream certificate, InputStream... certificationChain) throws IOException, GeneralSecurityException
privateKey - the private key to add.certificate - the associated certificate.certificationChain - the certification chain, ordered, the root certificate at the end.GeneralSecurityException - if the certificate could not be loaded or the private key could not be added.IOException - if the given privateKey could not be read.public void addClientKey(String privateKeyPath, String certificatePath, String... certificationChainPaths) throws IOException, GeneralSecurityException
Class.getResourceAsStream(String)).privateKeyPath - the path to the private key to add.certificatePath - the path to the associated certificate.certificationChainPaths - the paths to the certification chain, ordered, the root certificate at the end.GeneralSecurityException - if the certificate could not be loaded or the private key could not be added.IOException - if the given privateKey could not be read.public void addServerCertificate(InputStream certificate) throws GeneralSecurityException
certificate - the certificate to add.GeneralSecurityException - if the certificate could not be loaded or added.public void addServerCertificate(String certificatePath) throws GeneralSecurityException, IOException
Class.getResourceAsStream(String)).certificatePath - the path to the certificate to add.GeneralSecurityException - if the certificate could not be loaded or added.IOExceptionpublic void addServerCertificates(String[] trustedCertificates) throws GeneralSecurityException, IOException
trustedCertificates - IOExceptionGeneralSecurityExceptionpublic DTLSContext build(String keyStorePassword) throws GeneralSecurityException
keyStorePassword - the password of the key store.GeneralSecurityException - if an exception occurred while creating the DTLS context.