|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.jose.Header com.nimbusds.jose.CommonSEHeader com.nimbusds.jose.JWEHeader
public class JWEHeader
JSON Web Encryption (JWE) header.
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" }
Field Summary |
---|
Fields inherited from class com.nimbusds.jose.Header |
---|
alg |
Constructor Summary | |
---|---|
JWEHeader(JWEAlgorithm alg,
EncryptionMethod enc)
Creates a new JSON Web Encryption (JWE) header. |
Method Summary | |
---|---|
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. |
Set<String> |
getIncludedParameters()
Gets the names of all included parameters (reserved and custom) in the header instance. |
static Set<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(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(String name,
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. |
Methods inherited from class com.nimbusds.jose.CommonSEHeader |
---|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL, parseX509CertChain, setJWK, setJWKURL, setKeyID, setX509CertChain, setX509CertThumbprint, setX509CertURL |
Methods inherited from class com.nimbusds.jose.Header |
---|
getContentType, getCustomParameter, getCustomParameters, getType, parseAlgorithm, setContentType, setCustomParameters, setParsedBase64URL, setType, toBase64URL, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.nimbusds.jose.ReadOnlyCommonSEHeader |
---|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL |
Methods inherited from interface com.nimbusds.jose.ReadOnlyHeader |
---|
getContentType, getCustomParameter, getCustomParameters, getType, toBase64URL, toString |
Constructor Detail |
---|
public JWEHeader(JWEAlgorithm alg, EncryptionMethod enc)
alg
- The JWE algorithm parameter. Must not be null
.enc
- The encryption method parameter. Must not be null
.Method Detail |
---|
public static Set<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(String name, 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.
IllegalArgumentException
- If the specified parameter name
matches a reserved parameter name.public Set<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 ParseException
json
- The JSON object to parse. Must not be null
.
ParseException
- If the specified JSON object doesn't
represent a valid JWE header.public static JWEHeader parse(String s) throws ParseException
s
- The JSON string to parse. Must not be null
.
ParseException
- If the specified JSON object string doesn't
represent a valid JWE header.public static JWEHeader parse(Base64URL base64URL) throws ParseException
base64URL
- The Base64URL to parse. Must not be null
.
ParseException
- If the specified Base64URL doesn't represent a
valid JWE header.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |