Class AlgorithmExtensions
java.lang.Object
io.github.astrapi69.crypt.data.algorithm.AlgorithmExtensions
The class
AlgorithmExtensions
provides methods to validate if a given algorithm is
supported for a specific service and to retrieve the supported algorithms for a service-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlgorithms
(@NonNull String serviceName) Retrieves a set of algorithms for the specified Java cryptographic servicegetAllServiceNames
(Provider[] providers) Retrieves all specified Java cryptographic service names from the givenProvider
array objectgetServiceNames
(@NonNull Provider provider) Retrieves all specified Java cryptographic service names from the givenProvider
objectstatic boolean
Validates if the provided algorithm is supported for the given service name
-
Constructor Details
-
AlgorithmExtensions
public AlgorithmExtensions()
-
-
Method Details
-
isValid
public static boolean isValid(@NonNull @NonNull String serviceName, @NonNull @NonNull String algorithm) Validates if the provided algorithm is supported for the given service name- Parameters:
serviceName
- the name of the security servicealgorithm
- the algorithm to be validated- Returns:
- true if the algorithm is supported, false otherwise
-
getAlgorithms
Retrieves a set of algorithms for the specified Java cryptographic serviceThis method calls the
Security.getAlgorithms(String)
method to obtain a set of algorithm names supported by the specified security service- Parameters:
serviceName
- the name of the security service (e.g., "Cipher", "KeyAgreement", "MessageDigest", etc.) for which the supported algorithms are to be retrieved- Returns:
- a
Set
ofString
containing the names of the algorithms supported by the specified security service. The set is not modifiable - Throws:
NullPointerException
- ifserviceName
is null- See Also:
-
getServiceNames
Retrieves all specified Java cryptographic service names from the givenProvider
object -
getAllServiceNames
Retrieves all specified Java cryptographic service names from the givenProvider
array object- Parameters:
providers
- the array with theProvider
objects- Returns:
- a set of all specified Java cryptographic service names
-