- java.lang.Object
-
- dev.netcode.security.encryption.KeyLoader
-
public class KeyLoader extends java.lang.ObjectThis class simplifies the process of loading Keys from files
-
-
Constructor Summary
Constructors Constructor Description KeyLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static dev.netcode.util.Result<java.security.PrivateKey>loadPrivateKeyFromEncryptedFile(java.nio.file.Path file, java.lang.String password)Loads a Base64 encoded RSA private key from an encrypted filestatic java.security.PrivateKeyloadPrivateKeyFromFile(java.nio.file.Path file)Loads a Base64 encoded RSA private key from filestatic dev.netcode.util.Result<java.security.PublicKey>loadPublicKeyFromEncryptedFile(java.nio.file.Path file, java.lang.String password)Loads a Base64 encoded RSA public key from an encrypted filestatic java.security.PublicKeyloadPublicKeyFromFile(java.nio.file.Path file)Loads a Base64 encoded RSA public key from file
-
-
-
Method Detail
-
loadPublicKeyFromFile
public static java.security.PublicKey loadPublicKeyFromFile(java.nio.file.Path file) throws java.io.IOException, java.security.spec.InvalidKeySpecExceptionLoads 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:
java.io.IOException- if the file can not be readjava.security.spec.InvalidKeySpecException- in case the loaded key is malformed or currupted
-
loadPrivateKeyFromFile
public static java.security.PrivateKey loadPrivateKeyFromFile(java.nio.file.Path file) throws java.io.IOException, java.security.spec.InvalidKeySpecExceptionLoads 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:
java.io.IOException- if the file can not be readjava.security.spec.InvalidKeySpecException- in case the loaded key is malformed or currupted
-
loadPublicKeyFromEncryptedFile
public static dev.netcode.util.Result<java.security.PublicKey> loadPublicKeyFromEncryptedFile(java.nio.file.Path file, java.lang.String password) throws java.io.IOException, java.security.spec.InvalidKeySpecExceptionLoads 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:
java.io.IOException- if the file can not be readjava.security.spec.InvalidKeySpecException- in case the loaded key is malformed or currupted
-
loadPrivateKeyFromEncryptedFile
public static dev.netcode.util.Result<java.security.PrivateKey> loadPrivateKeyFromEncryptedFile(java.nio.file.Path file, java.lang.String password) throws java.io.IOException, java.security.spec.InvalidKeySpecExceptionLoads 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:
java.io.IOException- if the file can not be readjava.security.spec.InvalidKeySpecException- in case the loaded key is malformed or currupted
-
-