Class EncryptionAlgorithm
This class initializes itself using configuration values read from a config file, ensuring that the chosen algorithm for production is safe and valid.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor to initialize the EncryptionAlgorithm with configuration values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the encryption algorithm choices object.final intReturns the selected algorithm identifier for production.final StringReturns the selected algorithm for production as a string based on a predefined selection.
-
Constructor Details
-
EncryptionAlgorithm
public EncryptionAlgorithm()Constructor to initialize the EncryptionAlgorithm with configuration values.If more than one instance is created, it exits the system.
-
-
Method Details
-
getEncryptionAlgorithmChoices
Returns the encryption algorithm choices object.This method returns the current instance of
EncryptionAlgorithmChoicesassociated with this class. If, unexpectedly, the encryptionAlgorithmChoices object is null (which should not happen in normal operation), it will exit the system by callingSystem.exit(1).- Returns:
- The encryption algorithm choices object containing the available encryption algorithms.
-
getSELECTED_ALGORITHM_FOR_PRODUCTION
public final int getSELECTED_ALGORITHM_FOR_PRODUCTION()Returns the selected algorithm identifier for production.This method returns the current value of SELECTED_ALGORITHM_FOR_PRODUCTION, which represents the chosen encryption algorithm for production purposes. The integer returned corresponds to predefined choices in the system (e.g., 1, 2, or 3) that map to specific algorithms.
- Returns:
- An integer representing the selected algorithm identifier for production.
-
getSELECTED_ALGORITHM_FOR_PRODUCTION_STRING
Returns the selected algorithm for production as a string based on a predefined selection.This method checks the value of SELECTED_ALGORITHM_FOR_PRODUCTION and returns the corresponding encryption algorithm name from the encryptionAlgorithmChoices object. If none of the predefined values match, it returns "error".
- Returns:
- The selected algorithm for production as a string, or "error" if the selection is invalid.
-