Interface ChooseAlgorithm
This interface is part of a library that facilitates algorithm switching. It provides default implementations to help select an appropriate encryption algorithm based on the specified criteria, but its use is optional. Algorithm switching can still be performed without implementing this interface, though using it simplifies the process.
The chooseAlgorithmImplementation method uses a switch statement to determine which
implementation of the encryption algorithm should be used based on the value returned by the
getSELECTED_ALGORITHM_FOR_PRODUCTION() method of the provided EncryptionAlgorithm
instance.
Implementing classes must provide concrete implementations for the three methods:
implementAlgorithm1, implementAlgorithm2, and implementAlgorithm3.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidchooseAlgorithmImplementation(EncryptionAlgorithm encryptionAlgorithm) Chooses the appropriate algorithm implementation based on the provided encryption algorithm.voidImplement the first encryption algorithm.voidImplement the second encryption algorithm.voidImplement the third encryption algorithm.
-
Method Details
-
chooseAlgorithmImplementation
Chooses the appropriate algorithm implementation based on the provided encryption algorithm.- Parameters:
encryptionAlgorithm- The encryption algorithm whose selected algorithm will determine which method to invoke.
-
implementAlgorithm1
void implementAlgorithm1()Implement the first encryption algorithm. -
implementAlgorithm2
void implementAlgorithm2()Implement the second encryption algorithm. -
implementAlgorithm3
void implementAlgorithm3()Implement the third encryption algorithm.
-