public static class JWEHeader.Builder extends Object
Example usage:
JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.RSA1_5, EncryptionMethod.A128GCM). contentType("text/plain"). customParam("exp", new Date().getTime()). build();
Constructor and Description |
---|
Builder(JWEAlgorithm alg,
EncryptionMethod enc)
Creates a new JWE header builder.
|
Builder(JWEHeader jweHeader)
Creates a new JWE header builder with the parameters from
the specified header.
|
Modifier and Type | Method and Description |
---|---|
JWEHeader.Builder |
agreementPartyUInfo(Base64URL apu)
Sets the agreement PartyUInfo (
apu ) parameter. |
JWEHeader.Builder |
agreementPartyVInfo(Base64URL apv)
Sets the agreement PartyVInfo (
apv ) parameter. |
JWEHeader.Builder |
authTag(Base64URL tag)
Sets the authentication tag (
tag ) parameter. |
JWEHeader |
build()
Builds a new JWE header.
|
JWEHeader.Builder |
compressionAlgorithm(CompressionAlgorithm zip)
Sets the compression algorithm (
zip ) parameter. |
JWEHeader.Builder |
contentType(String cty)
Sets the content type (
cty ) parameter. |
JWEHeader.Builder |
criticalParams(Set<String> crit)
Sets the critical header parameters (
crit )
parameter. |
JWEHeader.Builder |
customParam(String name,
Object value)
Sets a custom (non-registered) parameter.
|
JWEHeader.Builder |
customParams(Map<String,Object> customParameters)
Sets the custom (non-registered) parameters.
|
JWEHeader.Builder |
ephemeralPublicKey(ECKey epk)
Sets the Ephemeral Public Key (
epk ) parameter. |
JWEHeader.Builder |
iv(Base64URL iv)
Sets the initialisation vector (
iv ) parameter. |
JWEHeader.Builder |
jwk(JWK jwk)
Sets the JSON Web Key (JWK) (
jwk ) parameter. |
JWEHeader.Builder |
jwkURL(URI jku)
Sets the JSON Web Key (JWK) Set URL (
jku ) parameter. |
JWEHeader.Builder |
keyID(String kid)
Sets the key ID (
kid ) parameter. |
JWEHeader.Builder |
parsedBase64URL(Base64URL base64URL)
Sets the parsed Base64URL.
|
JWEHeader.Builder |
pbes2Count(int p2c)
Sets the PBES2 count (
p2c ) parameter. |
JWEHeader.Builder |
pbes2Salt(Base64URL p2s)
Sets the PBES2 salt (
p2s ) parameter. |
JWEHeader.Builder |
type(JOSEObjectType typ)
Sets the type (
typ ) parameter. |
JWEHeader.Builder |
x509CertChain(List<Base64> x5c)
Sets the X.509 certificate chain parameter (
x5c )
corresponding to the key used to sign the JWS object. |
JWEHeader.Builder |
x509CertSHA256Thumbprint(Base64URL x5t256)
Sets the X.509 certificate SHA-256 thumbprint
(
x5t#s256 ) parameter. |
JWEHeader.Builder |
x509CertThumbprint(Base64URL x5t)
Deprecated.
|
JWEHeader.Builder |
x509CertURL(URI x5u)
Sets the X.509 certificate URL (
x5u ) parameter. |
public Builder(JWEAlgorithm alg, EncryptionMethod enc)
alg
- The JWE algorithm (alg
) parameter. Must
not be "none" or null
.enc
- The encryption method. Must not be null
.public JWEHeader.Builder type(JOSEObjectType typ)
typ
) parameter.typ
- The type parameter, null
if not
specified.public JWEHeader.Builder contentType(String cty)
cty
) parameter.cty
- The content type parameter, null
if not
specified.public JWEHeader.Builder criticalParams(Set<String> crit)
crit
)
parameter.crit
- The names of the critical header parameters,
empty set or null
if none.public JWEHeader.Builder jwkURL(URI jku)
jku
) parameter.jku
- The JSON Web Key (JWK) Set URL parameter,
null
if not specified.public JWEHeader.Builder jwk(JWK jwk)
jwk
) parameter.jwk
- The JSON Web Key (JWK) (jwk
) parameter,
null
if not specified.public JWEHeader.Builder x509CertURL(URI x5u)
x5u
) parameter.x5u
- The X.509 certificate URL parameter, null
if not specified.@Deprecated public JWEHeader.Builder x509CertThumbprint(Base64URL x5t)
x5t
)
parameter.x5t
- The X.509 certificate SHA-1 thumbprint parameter,
null
if not specified.public JWEHeader.Builder x509CertSHA256Thumbprint(Base64URL x5t256)
x5t#s256
) parameter.x5t256
- The X.509 certificate SHA-256 thumbprint
parameter, null
if not specified.public JWEHeader.Builder x509CertChain(List<Base64> x5c)
x5c
)
corresponding to the key used to sign the JWS object.x5c
- The X.509 certificate chain parameter,
null
if not specified.public JWEHeader.Builder keyID(String kid)
kid
) parameter.kid
- The key ID parameter, null
if not
specified.public JWEHeader.Builder ephemeralPublicKey(ECKey epk)
epk
) parameter.epk
- The Ephemeral Public Key parameter, null
if not specified.public JWEHeader.Builder compressionAlgorithm(CompressionAlgorithm zip)
zip
) parameter.zip
- The compression algorithm parameter, null
if not specified.public JWEHeader.Builder agreementPartyUInfo(Base64URL apu)
apu
) parameter.apu
- The agreement PartyUInfo parameter, null
if not specified.public JWEHeader.Builder agreementPartyVInfo(Base64URL apv)
apv
) parameter.apv
- The agreement PartyVInfo parameter, null
if not specified.public JWEHeader.Builder pbes2Salt(Base64URL p2s)
p2s
) parameter.p2s
- The PBES2 salt parameter, null
if not
specified.public JWEHeader.Builder pbes2Count(int p2c)
p2c
) parameter.p2c
- The PBES2 count parameter, zero if not specified.
Must not be negative.public JWEHeader.Builder iv(Base64URL iv)
iv
) parameter.iv
- The initialisation vector, null
if not
specified.public JWEHeader.Builder authTag(Base64URL tag)
tag
) parameter.tag
- The authentication tag, null
if not
specified.public JWEHeader.Builder customParam(String name, Object value)
name
- The name of the custom parameter. Must not
match a registered parameter name and must not
be null
.value
- The value of the custom parameter, should map
to a valid JSON entity, null
if not
specified.IllegalArgumentException
- If the specified parameter
name matches a registered
parameter name.public JWEHeader.Builder customParams(Map<String,Object> customParameters)
customParameters
- The custom parameters, empty map or
null
if none.public JWEHeader.Builder parsedBase64URL(Base64URL base64URL)
base64URL
- The parsed Base64URL, null
if the
header is created from scratch.Copyright © 2018 Connect2id Ltd.. All rights reserved.