Package de.craftsblock.craftsnet.api.ssl
Class SSL
java.lang.Object
de.craftsblock.craftsnet.api.ssl.SSL
The SSL class encapsulates a collection of utility methods aimed at facilitating SSL/TLS functionality
within an application. Serving as a central hub for SSL configuration management, this class offers
a range of methods for loading SSL contexts. These methods enable developers to seamlessly handle
SSL-related operations, including the loading of SSL contexts using either default or custom
certificate chain and private key files.
- Since:
- 2.1.1-SNAPSHOT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SSLContextThis method loads SSL context using default paths for the certificate chain and private key files.static SSLContextThis method loads an SSL context using the provided full chain and private key files.
-
Constructor Details
-
SSL
public SSL()
-
-
Method Details
-
load
public static SSLContext load(CraftsNet craftsNet) throws CertificateException, IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnrecoverableKeyException This method loads SSL context using default paths for the certificate chain and private key files. The default paths are "./certificates/fullchain.pem" for the certificate chain and "./certificates/privkey.pem" for the private key.- Parameters:
craftsNet- The CraftsNet instance which instantiates this ssl load operation.- Returns:
- The SSLContext instance loaded with the default certificate chain and private key.
- Throws:
CertificateException- If there's an error with the certificate.IOException- If there's an I/O error.NoSuchAlgorithmException- If the algorithm used is not available.KeyStoreException- If there's an error with the keystore.KeyManagementException- If there's an error with the key management.UnrecoverableKeyException- If the key is unrecoverable.
-
load
public static SSLContext load(CraftsNet craftsNet, String fullchain, String privkey) throws CertificateException, IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnrecoverableKeyException This method loads an SSL context using the provided full chain and private key files. It sets up an SSLContext with the certificate chain and private key from the given files.- Parameters:
craftsNet- The CraftsNet instance which instantiates this ssl load operation.fullchain- The path to the full chain file containing the certificate chain.privkey- The path to the private key file.- Returns:
- The SSLContext instance loaded with the provided certificate chain and private key.
- Throws:
CertificateException- If there's an error with the certificate.IOException- If there's an I/O error.NoSuchAlgorithmException- If the algorithm used is not available.KeyStoreException- If there's an error with the keystore.KeyManagementException- If there's an error with the key management.UnrecoverableKeyException- If the key is unrecoverable.
-