001package com.nimbusds.jose.jwk; 002 003 004import com.nimbusds.jose.HeaderParameterNames; 005import com.nimbusds.jwt.JWTClaimNames; 006 007 008/** 009 * JSON Web Key (JWK) parameter names. The JWK parameter names defined in 010 * <a href="https://datatracker.ietf.org/doc/html/rfc7517">RFC 7517</a> (JWK), 011 * <a href="https://datatracker.ietf.org/doc/html/rfc7518">RFC 7518</a> (JWA) 012 * and other JOSE related standards are tracked in a 013 * <a href="https://www.iana.org/assignments/jose/jose.xhtml#web-key-parameters">JWK 014 * parameters registry</a> administered by IANA. 015 * 016 * @author Nathaniel Hart 017 * @version 2024-04-27 018 */ 019public final class JWKParameterNames { 020 021 022 //////////////////////////////////////////////////////////////////////////////// 023 // Generic Key Parameters 024 //////////////////////////////////////////////////////////////////////////////// 025 026 027 /** 028 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.1">RFC 7517 "kty" (Key Type) Parameter</a> 029 */ 030 public static final String KEY_TYPE = "kty"; 031 032 033 /** 034 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.2">RFC 7517 "use" (Public Key Use) Parameter</a> 035 */ 036 public static final String PUBLIC_KEY_USE = "use"; 037 038 039 /** 040 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.3">RFC 7517 "key_ops" (Key Operations) Parameter</a> 041 */ 042 public static final String KEY_OPS = "key_ops"; 043 044 045 /** 046 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.4">RFC 7517 "alg" (Algorithm) Parameter</a> 047 */ 048 public static final String ALGORITHM = HeaderParameterNames.ALGORITHM; 049 050 051 /** 052 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.5">RFC 7517 "kid" (Key ID) Parameter</a> 053 */ 054 public static final String KEY_ID = HeaderParameterNames.KEY_ID; 055 056 057 /** 058 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.6">RFC 7517 "x5u" (X.509 Certificate URL) Parameter</a> 059 */ 060 public static final String X_509_CERT_URL = HeaderParameterNames.X_509_CERT_URL; 061 062 063 /** 064 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.7">RFC 7517 "x5c" (X.509 Certificate Chain) Parameter</a> 065 */ 066 public static final String X_509_CERT_CHAIN = HeaderParameterNames.X_509_CERT_CHAIN; 067 068 069 /** 070 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.8">RFC 7517 "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter</a> 071 */ 072 public static final String X_509_CERT_SHA_1_THUMBPRINT = HeaderParameterNames.X_509_CERT_SHA_1_THUMBPRINT; 073 074 075 /** 076 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7517#section-4.9">RFC 7517 "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 077 * Parameter</a> 078 */ 079 public static final String X_509_CERT_SHA_256_THUMBPRINT = HeaderParameterNames.X_509_CERT_SHA_256_THUMBPRINT; 080 081 082 /** 083 * @see <a href="https://openid.net/specs/openid-federation-1_0.html#name-iana-considerations">OpenID Federation 1.0</a> 084 */ 085 public static final String EXPIRATION_TIME = JWTClaimNames.EXPIRATION_TIME; 086 087 088 /** 089 * @see <a href="https://openid.net/specs/openid-federation-1_0.html#name-iana-considerations">OpenID Federation 1.0</a> 090 */ 091 public static final String NOT_BEFORE = JWTClaimNames.NOT_BEFORE; 092 093 094 /** 095 * @see <a href="https://openid.net/specs/openid-federation-1_0.html#name-iana-considerations">OpenID Federation 1.0</a> 096 */ 097 public static final String ISSUED_AT = JWTClaimNames.ISSUED_AT; 098 099 100 /** 101 * @see <a href="https://openid.net/specs/openid-federation-1_0.html#name-iana-considerations">OpenID Federation 1.0</a> 102 */ 103 public static final String REVOKED = "revoked"; 104 105 106 //////////////////////////////////////////////////////////////////////////////// 107 // Algorithm-Specific Key Parameters 108 //////////////////////////////////////////////////////////////////////////////// 109 110 111 // EC 112 113 /** 114 * Used with {@link KeyType#EC}. 115 * 116 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.1">RFC 7518 "crv" (EC Curve) Parameter</a> 117 */ 118 public static final String ELLIPTIC_CURVE = "crv"; 119 120 121 /** 122 * Used with {@link KeyType#EC}. 123 * 124 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.2">RFC 7518 "x" (EC X Coordinate) Parameter</a> 125 */ 126 public static final String ELLIPTIC_CURVE_X_COORDINATE = "x"; 127 128 129 /** 130 * Used with {@link KeyType#EC}. 131 * 132 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.3">RFC 7518 "y" (EC Y Coordinate) Parameter</a> 133 */ 134 public static final String ELLIPTIC_CURVE_Y_COORDINATE = "y"; 135 136 137 /** 138 * Used with {@link KeyType#EC}. 139 * 140 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.2.1">RFC 7518 "d" (EC Private Key) Parameter</a> 141 */ 142 public static final String ELLIPTIC_CURVE_PRIVATE_KEY = "d"; 143 144 145 // RSA 146 147 148 /** 149 * Used with {@link KeyType#RSA}. 150 * 151 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.1.1">RFC 7518 "n" (RSA Modulus) Parameter</a> 152 */ 153 public static final String RSA_MODULUS = "n"; 154 155 156 /** 157 * Used with {@link KeyType#RSA}. 158 * 159 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.1.2">RFC 7518 "e" (RSA Exponent) Parameter</a> 160 */ 161 public static final String RSA_EXPONENT = "e"; 162 163 164 /** 165 * Used with {@link KeyType#OKP}. 166 * 167 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.1">RFC 7518 "d" (RSA Private Exponent) Parameter</a> 168 */ 169 public static final String RSA_PRIVATE_EXPONENT = ELLIPTIC_CURVE_PRIVATE_KEY; 170 171 172 /** 173 * Used with {@link KeyType#RSA}. 174 * 175 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.2">RFC 7518 "p" (RSA First Prime Factor) Parameter</a> 176 */ 177 public static final String RSA_FIRST_PRIME_FACTOR = "p"; 178 179 180 /** 181 * Used with {@link KeyType#RSA}. 182 * 183 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.3">RFC 7518 "q" (RSA Second Prime Factor) Parameter</a> 184 */ 185 public static final String RSA_SECOND_PRIME_FACTOR = "q"; 186 187 188 /** 189 * Used with {@link KeyType#RSA}. 190 * 191 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.4">RFC 7518 "dp" (RSA First Factor CRT Exponent) Parameter</a> 192 */ 193 public static final String RSA_FIRST_FACTOR_CRT_EXPONENT = "dp"; 194 195 196 /** 197 * Used with {@link KeyType#RSA}. 198 * 199 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.5">RFC 7518 "dq" (RSA Second Factor CRT Exponent) Parameter</a> 200 */ 201 public static final String RSA_SECOND_FACTOR_CRT_EXPONENT = "dq"; 202 203 204 /** 205 * Used with {@link KeyType#RSA}. 206 * 207 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.6">RFC 7518 "qi" (RSA First CRT Coefficient) Parameter</a> 208 */ 209 public static final String RSA_FIRST_CRT_COEFFICIENT = "qi"; 210 211 212 /** 213 * Used with {@link KeyType#RSA}. 214 * 215 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.7">RFC 7518 "oth" (RSA Other Primes Info) Parameter</a> 216 */ 217 public static final String RSA_OTHER_PRIMES = "oth"; 218 219 220 /** 221 * Used with {@link KeyType#RSA}. 222 * 223 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.7.1">RFC 7518 "r" (RSA Other Primes Info - Prime Factor)</a> 224 */ 225 public static final String RSA_OTHER_PRIMES__PRIME_FACTOR = "r"; 226 227 228 /** 229 * Used with {@link KeyType#RSA}. 230 * 231 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.7.2">RFC 7518 "d" (RSA Other Primes Info - Factor CRT Exponent)</a> 232 */ 233 public static final String RSA_OTHER_PRIMES__FACTOR_CRT_EXPONENT = ELLIPTIC_CURVE_PRIVATE_KEY; 234 235 236 /** 237 * Used with {@link KeyType#RSA}. 238 * 239 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.7.3">RFC 7518 "t" (RSA Other Primes Info - Factor CRT Coefficient)</a> 240 */ 241 public static final String RSA_OTHER_PRIMES__FACTOR_CRT_COEFFICIENT = "t"; 242 243 244 // OCT 245 246 247 /** 248 * Used with {@link KeyType#OCT} 249 * 250 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.4.1">RFC 7518 "k" (OCT Key Value) Parameter</a> 251 */ 252 public static final String OCT_KEY_VALUE = "k"; 253 254 255 // OKP 256 257 /** 258 * Used with {@link KeyType#OKP}. 259 * 260 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "crv" (OKP Key Subtype) Parameter</a> 261 */ 262 public static final String OKP_SUBTYPE = ELLIPTIC_CURVE; 263 264 265 /** 266 * Used with {@link KeyType#OKP}. 267 * 268 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "x" (OKP Public Key) Parameter</a> 269 */ 270 public static final String OKP_PUBLIC_KEY = ELLIPTIC_CURVE_X_COORDINATE; 271 272 273 /** 274 * Used with {@link KeyType#OKP}. 275 * 276 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "d" (OKP Private Key) Parameter</a> 277 */ 278 public static final String OKP_PRIVATE_KEY = ELLIPTIC_CURVE_PRIVATE_KEY; 279 280 281 private JWKParameterNames() {} 282}