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, setX509CertURLgetContentType, getCustomParameter, getCustomParameters, getType, parseAlgorithm, setContentType, setCustomParameters, setType, toBase64URL, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURLgetContentType, getCustomParameter, getCustomParameters, getType, toBase64URLpublic 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()
ReadOnlyJWEHeaderalg) parameter.getAlgorithm in interface ReadOnlyHeadergetAlgorithm in interface ReadOnlyJWEHeaderpublic EncryptionMethod getEncryptionMethod()
ReadOnlyJWEHeaderenc) parameter.getEncryptionMethod in interface ReadOnlyJWEHeaderpublic ECKey getEphemeralPublicKey()
ReadOnlyJWEHeaderepk) parameter.getEphemeralPublicKey in interface ReadOnlyJWEHeadernull if not
specified.public void setEphemeralPublicKey(ECKey epk)
epk) parameter.epk - The Ephemeral Public Key parameter, null if not
specified.public CompressionAlgorithm getCompressionAlgorithm()
ReadOnlyJWEHeaderzip) parameter.getCompressionAlgorithm in interface ReadOnlyJWEHeadernull if not
specified.public void setCompressionAlgorithm(CompressionAlgorithm zip)
zip) parameter.zip - The compression algorithm parameter, null if not
specified.public Base64URL getAgreementPartyUInfo()
ReadOnlyJWEHeaderapu) parameter.getAgreementPartyUInfo in interface ReadOnlyJWEHeadernull if not
specified.public void setAgreementPartyUInfo(Base64URL apu)
apu) parameter.apu - The agreement PartyUInfo parameter, null if not
specified.public Base64URL getAgreementPartyVInfo()
ReadOnlyJWEHeaderapv) parameter.getAgreementPartyVInfo in interface ReadOnlyJWEHeadernull if not
specified.public void setAgreementPartyVInfo(Base64URL apv)
apv) parameter.apv - The agreement PartyVInfo parameter, null if not
specified.public Base64URL getEncryptionPartyUInfo()
ReadOnlyJWEHeaderepu) parameter.getEncryptionPartyUInfo in interface ReadOnlyJWEHeadernull if not
specified.public void setEncryptionPartyUInfo(Base64URL epu)
epu) parameter.epu - The encryption PartyUInfo parameter, null if not
specified.public Base64URL getEncryptionPartyVInfo()
ReadOnlyJWEHeaderepv) parameter.getEncryptionPartyVInfo in interface ReadOnlyJWEHeadernull 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)
HeadersetCustomParameter in class Headername - 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()
ReadOnlyHeadergetIncludedParameters in interface ReadOnlyHeaderpublic net.minidev.json.JSONObject toJSONObject()
ReadOnlyHeadertoJSONObject in interface ReadOnlyHeadertoJSONObject in class CommonSEHeaderpublic 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.