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