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 Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
    Logger.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns true of the key is not null and is an EC key.
    static boolean
    keyLengthSupportsMACAlgorithm(com.nimbusds.jose.JWSAlgorithm macAlg, Key key)
    Check the key length is compatible with the given JWS algorithm.
    static boolean
    keySupportsCurve(ECKey key, com.nimbusds.jose.JWSAlgorithm algorithm)
    Is the EC key supplied compatible with the EC Curve required by the algorithm given.
    static boolean
    keySupportsCurve(ECKey key, String algorithm)
    Is the EC key supplied compatible with the EC Curve required by the algorithm given.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 com.nimbusds.jose.JWSAlgorithm algorithm) throws com.nimbusds.jose.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:
      com.nimbusds.jose.JOSEException - if there is an issue deriving algorithms
    • keySupportsCurve

      public static boolean keySupportsCurve(@Nonnull ECKey key, @Nonnull @NotEmpty String algorithm) throws com.nimbusds.jose.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:
      com.nimbusds.jose.JOSEException - if there is an issue deriving algorithms
    • keyLengthSupportsMACAlgorithm

      public static boolean keyLengthSupportsMACAlgorithm(@Nonnull com.nimbusds.jose.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.