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