Class JWACredentialSupport
java.lang.Object
net.shibboleth.oidc.security.credential.JWACredentialSupport
Support class for JSON Web Algorithm credentials.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisECKeyType(Key key) Returns true of the key is not null and is an EC key.static booleankeyLengthSupportsMACAlgorithm(JWSAlgorithm macAlg, Key key) Check the key length is compatible with the given JWS algorithm.static booleankeySupportsCurve(ECKey key, 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.
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGLogger.
-
-
Constructor Details
-
JWACredentialSupport
private JWACredentialSupport()Constructor.
-
-
Method Details
-
isECKeyType
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 foralgorithm- 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 foralgorithm- the string algorithm to match compatibility against- Returns:
- true if compatible, false otherwise.
- Throws:
JOSEException- if there is an issue deriving algorithms
-
keyLengthSupportsMACAlgorithm
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.
-