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 org.slf4j.LoggerLOGLogger.
-
Constructor Summary
Constructors Modifier Constructor Description privateJWACredentialSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisECKeyType(Key key)Returns true of the key is not null and is an EC key.static booleankeyLengthSupportsMACAlgorithm(com.nimbusds.jose.JWSAlgorithm macAlg, Key key)Check the key length is compatible with the given JWS algorithm.static booleankeySupportsCurve(ECKey key, com.nimbusds.jose.JWSAlgorithm algorithm)Is the EC key supplied compatible with the EC Curve required by the algorithm given.static booleankeySupportsCurve(ECKey key, String algorithm)Is the EC key supplied compatible with the EC Curve required by the algorithm given.
-
-
-
Method Detail
-
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.JOSEExceptionIs the EC key supplied compatible with the EC Curve required by the algorithm given.- Parameters:
key- the key to check compatibility foralgorithm- 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.JOSEExceptionIs the EC key supplied compatible with the EC Curve required by the algorithm given.- Parameters:
key- the key to check compatibility foralgorithm- 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 checkkey- 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.
-
-