Class JWACredentialSupport

java.lang.Object
net.shibboleth.oidc.security.credential.JWACredentialSupport

public final class JWACredentialSupport extends Object
Support class for JSON Web Algorithm credentials.
  • Field Details

    • LOG

      @Nonnull private static final org.slf4j.Logger LOG
      Logger.
  • Constructor Details

    • JWACredentialSupport

      private JWACredentialSupport()
      Constructor.
  • Method Details

    • isECKeyType

      public static boolean isECKeyType(@Nullable Key key)
      Returns true of the key is not null and is an EC key.
      Parameters:
      key - the key to test
      Returns:
      true if either a private or public EC key exists
    • keySupportsCurve

      public static boolean keySupportsCurve(@Nonnull ECKey key, @Nonnull @NotEmpty JWSAlgorithm algorithm) throws JOSEException
      Is the EC key supplied compatible with the EC Curve required by the algorithm given.
      Parameters:
      key - the key to check compatibility for
      algorithm - the JWS algorithm to match compatibility against
      Returns:
      true if compatible, false otherwise.
      Throws:
      JOSEException - if there is an issue deriving algorithms
    • keySupportsCurve

      public static boolean keySupportsCurve(@Nonnull ECKey key, @Nonnull @NotEmpty String algorithm) throws JOSEException
      Is the EC key supplied compatible with the EC Curve required by the algorithm given.
      Parameters:
      key - the key to check compatibility for
      algorithm - the string algorithm to match compatibility against
      Returns:
      true if compatible, false otherwise.
      Throws:
      JOSEException - if there is an issue deriving algorithms
    • keyLengthSupportsMACAlgorithm

      public static boolean keyLengthSupportsMACAlgorithm(@Nonnull JWSAlgorithm macAlg, @Nonnull Key key)
      Check the key length is compatible with the given JWS algorithm. If not, or the given algorithm is not a MAC algorithm, return false.
      Parameters:
      macAlg - the MAC algorithm to check
      key - the key to check the length of
      Returns:
      true if the algorithm is a MAC algorithm and the key length is compatible with the MAC algorithm, false otherwise.