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 2022-02-26 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-connect-federation-1_0.html#name-iana-considerations">OpenID Connect 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-connect-federation-1_0.html#name-iana-considerations">OpenID Connect 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-connect-federation-1_0.html#name-iana-considerations">OpenID Connect Federation 1.0</a> 096 */ 097 public static final String ISSUED_AT = JWTClaimNames.ISSUED_AT; 098 099 100 //////////////////////////////////////////////////////////////////////////////// 101 // Algorithm-Specific Key Parameters 102 //////////////////////////////////////////////////////////////////////////////// 103 104 105 // EC 106 107 /** 108 * Used with {@link KeyType#EC}. 109 * 110 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.1">RFC 7518 "crv" (EC Curve) Parameter</a> 111 */ 112 public static final String ELLIPTIC_CURVE = "crv"; 113 114 115 /** 116 * Used with {@link KeyType#EC}. 117 * 118 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.2">RFC 7518 "x" (EC X Coordinate) Parameter</a> 119 */ 120 public static final String ELLIPTIC_CURVE_X_COORDINATE = "x"; 121 122 123 /** 124 * Used with {@link KeyType#EC}. 125 * 126 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.1.3">RFC 7518 "y" (EC Y Coordinate) Parameter</a> 127 */ 128 public static final String ELLIPTIC_CURVE_Y_COORDINATE = "y"; 129 130 131 /** 132 * Used with {@link KeyType#EC}. 133 * 134 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.2.2.1">RFC 7518 "d" (EC Private Key) Parameter</a> 135 */ 136 public static final String ELLIPTIC_CURVE_PRIVATE_KEY = "d"; 137 138 139 // RSA 140 141 142 /** 143 * Used with {@link KeyType#RSA}. 144 * 145 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.1.1">RFC 7518 "n" (RSA Modulus) Parameter</a> 146 */ 147 public static final String RSA_MODULUS = "n"; 148 149 150 /** 151 * Used with {@link KeyType#RSA}. 152 * 153 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.1.2">RFC 7518 "e" (RSA Exponent) Parameter</a> 154 */ 155 public static final String RSA_EXPONENT = "e"; 156 157 158 /** 159 * Used with {@link KeyType#OKP}. 160 * 161 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.1">RFC 7518 "d" (RSA Private Exponent) Parameter</a> 162 */ 163 public static final String RSA_PRIVATE_EXPONENT = ELLIPTIC_CURVE_PRIVATE_KEY; 164 165 166 /** 167 * Used with {@link KeyType#RSA}. 168 * 169 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.2">RFC 7518 "p" (RSA First Prime Factor) Parameter</a> 170 */ 171 public static final String RSA_FIRST_PRIME_FACTOR = "p"; 172 173 174 /** 175 * Used with {@link KeyType#RSA}. 176 * 177 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.3">RFC 7518 "q" (RSA Second Prime Factor) Parameter</a> 178 */ 179 public static final String RSA_SECOND_PRIME_FACTOR = "q"; 180 181 182 /** 183 * Used with {@link KeyType#RSA}. 184 * 185 * @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> 186 */ 187 public static final String RSA_FIRST_FACTOR_CRT_EXPONENT = "dp"; 188 189 190 /** 191 * Used with {@link KeyType#RSA}. 192 * 193 * @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> 194 */ 195 public static final String RSA_SECOND_FACTOR_CRT_EXPONENT = "dq"; 196 197 198 /** 199 * Used with {@link KeyType#RSA}. 200 * 201 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.6">RFC 7518 "qi" (RSA First CRT Coefficient) Parameter</a> 202 */ 203 public static final String RSA_FIRST_CRT_COEFFICIENT = "qi"; 204 205 206 /** 207 * Used with {@link KeyType#RSA}. 208 * 209 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.3.2.7">RFC 7518 "oth" (RSA Other Primes Info) Parameter</a> 210 */ 211 public static final String RSA_OTHER_PRIMES = "oth"; 212 213 214 /** 215 * Used with {@link KeyType#RSA}. 216 * 217 * @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> 218 */ 219 public static final String RSA_OTHER_PRIMES__PRIME_FACTOR = "r"; 220 221 222 /** 223 * Used with {@link KeyType#RSA}. 224 * 225 * @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> 226 */ 227 public static final String RSA_OTHER_PRIMES__FACTOR_CRT_EXPONENT = ELLIPTIC_CURVE_PRIVATE_KEY; 228 229 230 /** 231 * Used with {@link KeyType#RSA}. 232 * 233 * @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> 234 */ 235 public static final String RSA_OTHER_PRIMES__FACTOR_CRT_COEFFICIENT = "t"; 236 237 238 // OCT 239 240 241 /** 242 * Used with {@link KeyType#OCT} 243 * 244 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-6.4.1">RFC 7518 "k" (OCT Key Value) Parameter</a> 245 */ 246 public static final String OCT_KEY_VALUE = "k"; 247 248 249 // OKP 250 251 /** 252 * Used with {@link KeyType#OKP}. 253 * 254 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "crv" (OKP Key Subtype) Parameter</a> 255 */ 256 public static final String OKP_SUBTYPE = ELLIPTIC_CURVE; 257 258 259 /** 260 * Used with {@link KeyType#OKP}. 261 * 262 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "x" (OKP Public Key) Parameter</a> 263 */ 264 public static final String OKP_PUBLIC_KEY = ELLIPTIC_CURVE_X_COORDINATE; 265 266 267 /** 268 * Used with {@link KeyType#OKP}. 269 * 270 * @see <a href="https://datatracker.ietf.org/doc/html/rfc8037#section-2">RFC 8037 "d" (OKP Private Key) Parameter</a> 271 */ 272 public static final String OKP_PRIVATE_KEY = ELLIPTIC_CURVE_PRIVATE_KEY; 273 274 275 private JWKParameterNames() {} 276}