public class JWEHeader extends CommonSEHeader implements ReadOnlyJWEHeader
Supports all reserved header parameters
of the JWE specification:
The header may also carry custom parameters
;
these will be serialised and parsed along the reserved ones.
Example header:
{ "alg" : "RSA1_5", "enc" : "A128CBC+HS256" }
Constructor and Description |
---|
JWEHeader(JWEAlgorithm alg,
EncryptionMethod enc)
Creates a new JSON Web Encryption (JWE) header.
|
Modifier and Type | Method and Description |
---|---|
Base64URL |
getAgreementPartyUInfo()
Gets the agreement PartyUInfo (
apu ) parameter. |
Base64URL |
getAgreementPartyVInfo()
Gets the agreement PartyVInfo (
apv ) parameter. |
JWEAlgorithm |
getAlgorithm()
Gets the algorithm (
alg ) parameter. |
CompressionAlgorithm |
getCompressionAlgorithm()
Gets the compression algorithm (
zip ) parameter. |
EncryptionMethod |
getEncryptionMethod()
Gets the encryption method (
enc ) parameter. |
Base64URL |
getEncryptionPartyUInfo()
Gets the encryption PartyUInfo (
epu ) parameter. |
Base64URL |
getEncryptionPartyVInfo()
Gets the encryption PartyVInfo (
epv ) parameter. |
ECKey |
getEphemeralPublicKey()
Gets the Ephemeral Public Key (
epk ) parameter. |
java.util.Set<java.lang.String> |
getIncludedParameters()
Gets the names of all included parameters (reserved and custom) in
the header instance.
|
static java.util.Set<java.lang.String> |
getReservedParameterNames()
Gets the reserved parameter names for JWE headers.
|
static JWEHeader |
parse(Base64URL base64URL)
Parses a JWE header from the specified Base64URL.
|
static JWEHeader |
parse(net.minidev.json.JSONObject json)
Parses a JWE header from the specified JSON object.
|
static JWEHeader |
parse(java.lang.String s)
Parses a JWE header from the specified JSON string.
|
void |
setAgreementPartyUInfo(Base64URL apu)
Sets the agreement PartyUInfo (
apu ) parameter. |
void |
setAgreementPartyVInfo(Base64URL apv)
Sets the agreement PartyVInfo (
apv ) parameter. |
void |
setCompressionAlgorithm(CompressionAlgorithm zip)
Sets the compression algorithm (
zip ) parameter. |
void |
setCustomParameter(java.lang.String name,
java.lang.Object value)
Sets a custom (non-reserved) parameter.
|
void |
setEncryptionPartyUInfo(Base64URL epu)
Sets the encryption PartyUInfo (
epu ) parameter. |
void |
setEncryptionPartyVInfo(Base64URL epv)
Sets the encryption PartyVInfo (
epv ) parameter. |
void |
setEphemeralPublicKey(ECKey epk)
Sets the Ephemeral Public Key (
epk ) parameter. |
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of the header.
|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL, parseX509CertChain, setJWK, setJWKURL, setKeyID, setX509CertChain, setX509CertThumbprint, setX509CertURL
getContentType, getCustomParameter, getCustomParameters, getType, parseAlgorithm, setContentType, setCustomParameters, setType, toBase64URL, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL
getContentType, getCustomParameter, getCustomParameters, getType, toBase64URL
public JWEHeader(JWEAlgorithm alg, EncryptionMethod enc)
alg
- The JWE algorithm parameter. Must not be null
.enc
- The encryption method parameter. Must not be null
.public static java.util.Set<java.lang.String> getReservedParameterNames()
public JWEAlgorithm getAlgorithm()
ReadOnlyJWEHeader
alg
) parameter.getAlgorithm
in interface ReadOnlyHeader
getAlgorithm
in interface ReadOnlyJWEHeader
public EncryptionMethod getEncryptionMethod()
ReadOnlyJWEHeader
enc
) parameter.getEncryptionMethod
in interface ReadOnlyJWEHeader
public ECKey getEphemeralPublicKey()
ReadOnlyJWEHeader
epk
) parameter.getEphemeralPublicKey
in interface ReadOnlyJWEHeader
null
if not
specified.public void setEphemeralPublicKey(ECKey epk)
epk
) parameter.epk
- The Ephemeral Public Key parameter, null
if not
specified.public CompressionAlgorithm getCompressionAlgorithm()
ReadOnlyJWEHeader
zip
) parameter.getCompressionAlgorithm
in interface ReadOnlyJWEHeader
null
if not
specified.public void setCompressionAlgorithm(CompressionAlgorithm zip)
zip
) parameter.zip
- The compression algorithm parameter, null
if not
specified.public Base64URL getAgreementPartyUInfo()
ReadOnlyJWEHeader
apu
) parameter.getAgreementPartyUInfo
in interface ReadOnlyJWEHeader
null
if not
specified.public void setAgreementPartyUInfo(Base64URL apu)
apu
) parameter.apu
- The agreement PartyUInfo parameter, null
if not
specified.public Base64URL getAgreementPartyVInfo()
ReadOnlyJWEHeader
apv
) parameter.getAgreementPartyVInfo
in interface ReadOnlyJWEHeader
null
if not
specified.public void setAgreementPartyVInfo(Base64URL apv)
apv
) parameter.apv
- The agreement PartyVInfo parameter, null
if not
specified.public Base64URL getEncryptionPartyUInfo()
ReadOnlyJWEHeader
epu
) parameter.getEncryptionPartyUInfo
in interface ReadOnlyJWEHeader
null
if not
specified.public void setEncryptionPartyUInfo(Base64URL epu)
epu
) parameter.epu
- The encryption PartyUInfo parameter, null
if not
specified.public Base64URL getEncryptionPartyVInfo()
ReadOnlyJWEHeader
epv
) parameter.getEncryptionPartyVInfo
in interface ReadOnlyJWEHeader
null
if not
specified.public void setEncryptionPartyVInfo(Base64URL epv)
epv
) parameter.epv
- The encryption PartyVInfo parameter, null
if not
specified.public void setCustomParameter(java.lang.String name, java.lang.Object value)
Header
setCustomParameter
in class Header
name
- The name of the custom parameter. Must not match a
reserved 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.java.lang.IllegalArgumentException
- If the specified parameter name
matches a reserved parameter name.public java.util.Set<java.lang.String> getIncludedParameters()
ReadOnlyHeader
getIncludedParameters
in interface ReadOnlyHeader
public net.minidev.json.JSONObject toJSONObject()
ReadOnlyHeader
toJSONObject
in interface ReadOnlyHeader
toJSONObject
in class CommonSEHeader
public static JWEHeader parse(net.minidev.json.JSONObject json) throws java.text.ParseException
json
- The JSON object to parse. Must not be null
.java.text.ParseException
- If the specified JSON object doesn't
represent a valid JWE header.public static JWEHeader parse(java.lang.String s) throws java.text.ParseException
s
- The JSON string to parse. Must not be null
.java.text.ParseException
- If the specified JSON object string doesn't
represent a valid JWE header.public static JWEHeader parse(Base64URL base64URL) throws java.text.ParseException
base64URL
- The Base64URL to parse. Must not be null
.java.text.ParseException
- If the specified Base64URL doesn't represent a
valid JWE header.Copyright © 2013 NimbusDS. All Rights Reserved.