java.lang.Object
io.github.astrapi69.crypt.data.algorithm.AlgorithmExtensions

public class AlgorithmExtensions extends Object
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 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 service
      algorithm - the algorithm to be validated
      Returns:
      true if the algorithm is supported, false otherwise
    • getAlgorithms

      public static Set<String> getAlgorithms(@NonNull @NonNull String serviceName)
      Retrieves a set of algorithms for the specified Java cryptographic service

      This 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 of String containing the names of the algorithms supported by the specified security service. The set is not modifiable
      Throws:
      NullPointerException - if serviceName is null
      See Also:
    • getServiceNames

      public static Set<String> getServiceNames(@NonNull @NonNull Provider provider)
      Retrieves all specified Java cryptographic service names from the given Provider object
      Parameters:
      provider - the Provider object
      Returns:
      a set of all specified Java cryptographic service names from the given Provider object
    • getAllServiceNames

      public static Set<String> getAllServiceNames(Provider[] providers)
      Retrieves all specified Java cryptographic service names from the given Provider array object
      Parameters:
      providers - the array with the Provider objects
      Returns:
      a set of all specified Java cryptographic service names