001package com.nimbusds.jose; 002 003 004/** 005 * JSON Web Signature (JWS) and JSON Web Encryption (JWE) header parameter 006 * names. 007 * 008 * <p>The header parameter names defined in 009 * <a href="https://datatracker.ietf.org/doc/html/rfc7515">RFC 7515</a> (JWS), 010 * <a href="https://datatracker.ietf.org/doc/html/rfc7516">RFC 7516</a> (JWE) 011 * and other JOSE related standards are tracked in a 012 * <a href="https://www.iana.org/assignments/jose/jose.xhtml#web-signature-encryption-header-parameters">JWS 013 * and JWE header parameters registry</a> administered by IANA. 014 * 015 * <p>Note, some header parameters here may not be present in the IANA registry 016 * (yet). 017 * 018 * @author Nathaniel Hart 019 * @version 2021-09-30 020 */ 021public final class HeaderParameterNames { 022 023 024 //////////////////////////////////////////////////////////////////////////////// 025 // Generic JWS and JWE Header Parameters 026 //////////////////////////////////////////////////////////////////////////////// 027 028 029 /** 030 * Used in {@link JWSHeader} and {@link JWEHeader}. 031 * 032 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.1">RFC 7515 "alg" (JWS Algorithm) Header Parameter</a> 033 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.1">RFC 7516 "alg" (JWE Algorithm) Header Parameter</a> 034 */ 035 public static final String ALGORITHM = "alg"; 036 037 038 /** 039 * Used in {@link JWEHeader}. 040 * 041 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.2">RFC 7516 "enc" (Encryption Algorithm) Header Parameter</a> 042 */ 043 public static final String ENCRYPTION_ALGORITHM = "enc"; 044 045 046 /** 047 * Used in {@link JWEHeader}. 048 * 049 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.3">RFC 7516 "zip" (Compression Algorithm) Header Parameter</a> 050 */ 051 public static final String COMPRESSION_ALGORITHM = "zip"; 052 053 054 /** 055 * Used in {@link JWSHeader} and {@link JWEHeader}. 056 * 057 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2">RFC 7515 "jku" (JWK Set URL) Header Parameter</a> 058 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.4">RFC 7516 "jku" (JWK Set URL) Header Parameter</a> 059 */ 060 public static final String JWK_SET_URL = "jku"; 061 062 063 /** 064 * Used in {@link JWSHeader} and {@link JWEHeader}. 065 * 066 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.3">RFC 7515 "jwk" (JSON Web Key) Header Parameter</a> 067 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.5">RFC 7516 "jwk" (JSON Web Key) Header Parameter</a> 068 */ 069 public static final String JWK = "jwk"; 070 071 072 /** 073 * Used in {@link JWSHeader} and {@link JWEHeader}. 074 * 075 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.4">RFC 7515 "kid" (Key ID) Header Parameter</a> 076 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.6">RFC 7516 "kid" (Key ID) Header Parameter</a> 077 */ 078 public static final String KEY_ID = "kid"; 079 080 081 /** 082 * Used in {@link JWSHeader} and {@link JWEHeader}. 083 * 084 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.5">RFC 7515 "x5u" (X.509 Certificate URL) Header Parameter</a> 085 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.7">RFC 7516 "x5u" (X.509 Certificate URL) Header Parameter</a> 086 */ 087 public static final String X_509_CERT_URL = "x5u"; 088 089 090 /** 091 * Used in {@link JWSHeader} and {@link JWEHeader}. 092 * 093 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.6">RFC 7515 "x5c" (X.509 Certificate Chain) Header Parameter</a> 094 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.8">RFC 7516 "x5c" (X.509 Certificate Chain) Header Parameter</a> 095 */ 096 public static final String X_509_CERT_CHAIN = "x5c"; 097 098 099 /** 100 * Used in {@link JWSHeader} and {@link JWEHeader}. 101 * 102 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.7">RFC 7515 "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter</a> 103 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.9">RFC 7516 "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter</a> 104 */ 105 public static final String X_509_CERT_SHA_1_THUMBPRINT = "x5t"; 106 107 108 /** 109 * Used in {@link JWSHeader} and {@link JWEHeader}. 110 * 111 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.8">RFC 7515 "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter</a> 112 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.10">RFC 7516 "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter</a> 113 */ 114 public static final String X_509_CERT_SHA_256_THUMBPRINT = "x5t#S256"; 115 116 117 /** 118 * Used in {@link JWSHeader} and {@link JWEHeader}. 119 * 120 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.9">RFC 7515 "typ" (Type) Header Parameter</a> 121 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.11">RFC 7516 "typ" (Type) Header Parameter</a> 122 */ 123 public static final String TYPE = "typ"; 124 125 126 /** 127 * Used in {@link JWSHeader} and {@link JWEHeader}. 128 * 129 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.10">RFC 7515 "cty" (Content Type) Header Parameter</a> 130 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.12">RFC 7516 "cty" (Content Type) Header Parameter</a> 131 */ 132 public static final String CONTENT_TYPE = "cty"; 133 134 135 /** 136 * Used in {@link JWSHeader} and {@link JWEHeader}. 137 * 138 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.11">RFC 7515 "crit" (Critical) Header Parameter</a> 139 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.13">RFC 7516 "crit" (Critical) Header Parameter</a> 140 */ 141 public static final String CRITICAL = "crit"; 142 143 144 //////////////////////////////////////////////////////////////////////////////// 145 // Algorithm-Specific Header Parameters 146 //////////////////////////////////////////////////////////////////////////////// 147 148 149 /** 150 * Used in {@link JWEHeader} with ECDH key agreement. 151 * 152 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.6.1.1">RFC 7518 "epk" (Ephemeral Public Key) Header Parameter</a> 153 */ 154 public static final String EPHEMERAL_PUBLIC_KEY = "epk"; 155 156 157 /** 158 * Used in {@link JWEHeader} with ECDH key agreement. 159 * 160 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.6.1.2">RFC 7518 "apu" (Agreement PartyUInfo) Header Parameter</a> 161 */ 162 public static final String AGREEMENT_PARTY_U_INFO = "apu"; 163 164 165 /** 166 * Used in {@link JWEHeader} with ECDH key agreement. 167 * 168 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.6.1.3">RFC 7518 "apv" (Agreement PartyVInfo) Header Parameter</a> 169 */ 170 public static final String AGREEMENT_PARTY_V_INFO = "apv"; 171 172 173 /** 174 * Used in {@link JWEHeader} with AES GCN key encryption. 175 * 176 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.7.1.1">RFC 7518 "iv" (Initialization Vector) Header Parameter</a> 177 */ 178 public static final String INITIALIZATION_VECTOR = "iv"; 179 180 181 /** 182 * Used in {@link JWEHeader} with AES GCN key encryption. 183 * 184 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.7.1.2">RFC 7518 "tag" (Authentication Tag) Header Parameter</a> 185 */ 186 public static final String AUTHENTICATION_TAG = "tag"; 187 188 189 /** 190 * Used in {@link JWEHeader} with PBES2 key encryption. 191 * 192 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.8.1.1">RFC 7518 "p2s" (PBES2 Salt Input) Header Parameter</a> 193 */ 194 public static final String PBES2_SALT_INPUT = "p2s"; 195 196 197 /** 198 * Used in {@link JWEHeader} with PBES2 key encryption. 199 * 200 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7518#section-4.8.1.2">RFC 7518 "p2c" (PBES2 Count) Header Parameter</a> 201 */ 202 public static final String PBES2_COUNT = "p2c"; 203 204 205 /** 206 * Used in {@link JWEHeader} with ECDH-1PU key agreement. 207 * 208 * @see <a href="https://datatracker.ietf.org/doc/html/draft-madden-jose-ecdh-1pu-04#section-2.2.1">"skid" Header Parameter</a> 209 */ 210 public static final String SENDER_KEY_ID = "skid"; 211 212 213 //////////////////////////////////////////////////////////////////////////////// 214 // RFC 7797 (JWS Unencoded Payload Option) Header Parameters 215 //////////////////////////////////////////////////////////////////////////////// 216 217 218 /** 219 * Used in {@link JWSHeader} with unencoded {@link Payload}. 220 * 221 * @see <a href="https://datatracker.ietf.org/doc/html/rfc7797#section-3">RFC 7797 "b64" (base64url-encode payload) Header Parameter</a> 222 */ 223 public static final String BASE64_URL_ENCODE_PAYLOAD = "b64"; 224 225 226 private HeaderParameterNames() {} 227}