java.lang.Object
dev.netcode.security.encryption.KeyLoader
This class simplifies the process of loading Keys from files
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic dev.netcode.util.Result<PrivateKey>loadPrivateKeyFromEncryptedFile(Path file, String password)Loads a Base64 encoded RSA private key from an encrypted filestatic PrivateKeyloadPrivateKeyFromFile(Path file)Loads a Base64 encoded RSA private key from filestatic dev.netcode.util.Result<PublicKey>loadPublicKeyFromEncryptedFile(Path file, String password)Loads a Base64 encoded RSA public key from an encrypted filestatic PublicKeyloadPublicKeyFromFile(Path file)Loads a Base64 encoded RSA public key from file
-
Constructor Details
-
KeyLoader
public KeyLoader()
-
-
Method Details
-
loadPublicKeyFromFile
Loads a Base64 encoded RSA public key from file- Parameters:
file- Path of the file containing the Base64 encoded public key- Returns:
- the public key
- Throws:
IOException- if the file can not be read
-
loadPrivateKeyFromFile
Loads a Base64 encoded RSA private key from file- Parameters:
file- Path of the file containing the Base64 encoded private key- Returns:
- the private key
- Throws:
IOException- if the file can not be read
-
loadPublicKeyFromEncryptedFile
public static dev.netcode.util.Result<PublicKey> loadPublicKeyFromEncryptedFile(Path file, String password) throws IOExceptionLoads a Base64 encoded RSA public key from an encrypted file- Parameters:
file- Path of the file containing the Base64 encoded public keypassword- used to decrypt the file- Returns:
- the public key
- Throws:
IOException- if the file can not be read
-
loadPrivateKeyFromEncryptedFile
public static dev.netcode.util.Result<PrivateKey> loadPrivateKeyFromEncryptedFile(Path file, String password) throws IOExceptionLoads a Base64 encoded RSA private key from an encrypted file- Parameters:
file- Path of the file containing the Base64 encoded private keypassword- used to decrypt the file- Returns:
- the private key
- Throws:
IOException- if the file can not be read
-