java.lang.Object
dev.netcode.security.encryption.KeyGenerator
This class can be used to generate RSA cryptographic keys and safe them to file
- See Also:
RSAEncrypter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangenerateKeys(int size, Path publicKeyFile, Path privateKeyFile)Generates RSA Keys of given size and saves them to filesstatic booleangenerateKeys(int size, Path publicKeyFile, Path privateKeyFile, String password)Generates RSA Keys of given size, encrypts them using AES and saves them to files
-
Constructor Details
-
KeyGenerator
public KeyGenerator()
-
-
Method Details
-
generateKeys
Generates RSA Keys of given size and saves them to files- Parameters:
size- of the keys (the bigger, the more secure)publicKeyFile- Path to the file the public key will be saved to. File will be created if it doesn't already existprivateKeyFile- Path to the file the private key will be saved to. File will be created if it doesn't already exist- Returns:
- true if everything was completed successfully. false otherwise
-
generateKeys
public static boolean generateKeys(int size, Path publicKeyFile, Path privateKeyFile, String password)Generates RSA Keys of given size, encrypts them using AES and saves them to files- Parameters:
size- of the keys (the bigger, the more secure)publicKeyFile- Path to the file the public key will be saved to. File will be created if it doesn't already existprivateKeyFile- Path to the file the private key will be saved to. File will be created if it doesn't already existpassword- to be used to encrypt the keys- Returns:
- true if everything was completed successfully. false otherwise
-