Enum Class JwkSkipReason

java.lang.Object
java.lang.Enum<JwkSkipReason>
com.revetsec.jose.JwkSkipReason
All Implemented Interfaces:
Serializable, Comparable<JwkSkipReason>, Constable

Why a key in a JSON Web Key Set is not used.

A key that fails any rule is skipped, never used for part of what it holds, and it never makes the whole set fail (RFC 7517 section 5). Only the document's structure or size does that. The checks run in a fixed order, and the first one that fails names the reason:

  1. kty is missing or not a string: MALFORMED_KEY;
  2. kty is not RSA, EC or OKP: SYMMETRIC_KEY for oct, otherwise UNSUPPORTED_KEY_TYPE;
  3. a private or symmetric member (d, p, q, dp, dq, qi, oth or k) is present: PRIVATE_KEY_MEMBERS;
  4. use or key_ops does not allow verification: NOT_A_VERIFICATION_KEY;
  5. alg is not a JwsAlgorithm, or names another key type or curve: UNSUPPORTED_ALGORITHM or ALGORITHM_MISMATCH;
  6. crv names an unsupported curve: UNSUPPORTED_CURVE;
  7. a member is missing, of the wrong type or not canonically encoded: MALFORMED_KEY;
  8. the RSA modulus size is out of range: RSA_KEY_SIZE;
  9. the RSA public exponent is out of range: RSA_EXPONENT;
  10. the EC point is not on its curve: EC_POINT_NOT_ON_CURVE;
  11. the key is known to be weak: WEAK_KEY;
  12. x5c does not hold the same key: CERTIFICATE_MISMATCH.
This enum is not switch-stable: a later release may add constants, so a switch over it needs a default branch.
Since:
1.0.0
Author:
Mark Allen
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The key's alg names an algorithm for another key type or curve, such as ES384 on a P-256 key or any HMAC algorithm.
    The key's x5c is not an array whose first element is a certificate in standard base64 that parses strictly, or that certificate holds a different key.
    An EC coordinate is not below the field prime, or the point is not on the curve.
    A member is missing, has the wrong JSON type or is not canonically encoded: kty missing or not a string; a required key member (n and e, crv with x and y, or crv with x) missing, not a string or not canonical base64url; an RSA integer with a leading zero octet or an even modulus; an EC coordinate of the wrong length; an Ed25519 x that is not 32 octets or does not decode to a curve point (RFC 8032 section 5.1.3); a kid that is not a string of 1 to 256 characters; or an issuer member that is present but not a non-empty string.
    The key is not for verifying signatures: its use is not sig, its key_ops is not an array of strings that contains verify, or the two members disagree (RFC 7517 sections 4.2 and 4.3).
    The key holds a private or symmetric member (d, p, q, dp, dq, qi, oth or k), so the set publishes key material it should not.
    The RSA public exponent is even, below 65537 or at least 232.
    The RSA modulus is shorter than 2048 or longer than 16384 bits.
    The key is symmetric (kty oct).
    The key's alg is present but is not a JwsAlgorithm wire value, such as RSA-OAEP or ES521.
    The key's curve (crv) is not P-256, P-384 or P-521 for an EC key, or not Ed25519 for an OKP key.
    The key type (kty) is not RSA, EC, OKP or oct.
    The key is well formed but known to be weak: an RSA modulus with the ROCA fingerprint (CVE-2017-15361), or an Ed25519 point of small order.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    static JwkSkipReason[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • MALFORMED_KEY

      public static final JwkSkipReason MALFORMED_KEY
      A member is missing, has the wrong JSON type or is not canonically encoded: kty missing or not a string; a required key member (n and e, crv with x and y, or crv with x) missing, not a string or not canonical base64url; an RSA integer with a leading zero octet or an even modulus; an EC coordinate of the wrong length; an Ed25519 x that is not 32 octets or does not decode to a curve point (RFC 8032 section 5.1.3); a kid that is not a string of 1 to 256 characters; or an issuer member that is present but not a non-empty string.
    • UNSUPPORTED_KEY_TYPE

      public static final JwkSkipReason UNSUPPORTED_KEY_TYPE
      The key type (kty) is not RSA, EC, OKP or oct.
    • SYMMETRIC_KEY

      public static final JwkSkipReason SYMMETRIC_KEY
      The key is symmetric (kty oct). Revetsec verifies only with public keys from a key set.
    • PRIVATE_KEY_MEMBERS

      public static final JwkSkipReason PRIVATE_KEY_MEMBERS
      The key holds a private or symmetric member (d, p, q, dp, dq, qi, oth or k), so the set publishes key material it should not. Its public half is not used either.
    • NOT_A_VERIFICATION_KEY

      The key is not for verifying signatures: its use is not sig, its key_ops is not an array of strings that contains verify, or the two members disagree (RFC 7517 sections 4.2 and 4.3).
    • UNSUPPORTED_ALGORITHM

      public static final JwkSkipReason UNSUPPORTED_ALGORITHM
      The key's alg is present but is not a JwsAlgorithm wire value, such as RSA-OAEP or ES521.
    • ALGORITHM_MISMATCH

      public static final JwkSkipReason ALGORITHM_MISMATCH
      The key's alg names an algorithm for another key type or curve, such as ES384 on a P-256 key or any HMAC algorithm.
    • UNSUPPORTED_CURVE

      public static final JwkSkipReason UNSUPPORTED_CURVE
      The key's curve (crv) is not P-256, P-384 or P-521 for an EC key, or not Ed25519 for an OKP key. A key on secp256k1, Ed448, X25519 or X448 is skipped here unless an earlier check refuses it first: UNSUPPORTED_ALGORITHM for alg ES256K or ECDH-ES, or NOT_A_VERIFICATION_KEY for use enc.
    • RSA_KEY_SIZE

      public static final JwkSkipReason RSA_KEY_SIZE
      The RSA modulus is shorter than 2048 or longer than 16384 bits.
    • RSA_EXPONENT

      public static final JwkSkipReason RSA_EXPONENT
      The RSA public exponent is even, below 65537 or at least 232.
    • EC_POINT_NOT_ON_CURVE

      public static final JwkSkipReason EC_POINT_NOT_ON_CURVE
      An EC coordinate is not below the field prime, or the point is not on the curve.
    • WEAK_KEY

      public static final JwkSkipReason WEAK_KEY
      The key is well formed but known to be weak: an RSA modulus with the ROCA fingerprint (CVE-2017-15361), or an Ed25519 point of small order.
    • CERTIFICATE_MISMATCH

      public static final JwkSkipReason CERTIFICATE_MISMATCH
      The key's x5c is not an array whose first element is a certificate in standard base64 that parses strictly, or that certificate holds a different key.
  • Method Details

    • values

      public static JwkSkipReason[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static JwkSkipReason valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null