@ThreadSafe public class JWEObjectJSON extends JOSEObject implements JSONSerializable
| Modifier and Type | Class and Description |
|---|---|
static class |
JWEObjectJSON.State
Enumeration of the states of a JSON Web Encryption (JWE) object.
|
MIME_TYPE_COMPACT, MIME_TYPE_JS| Constructor and Description |
|---|
JWEObjectJSON(Base64URL header,
List<JWERecipient> recipients,
Base64URL iv,
Base64URL ciphertext,
Base64URL tag)
Creates a new encrypted JSON Web Encryption (JWE) object with the
specified serialised parts.
|
JWEObjectJSON(JWEHeader header,
Payload payload)
Creates a new to-be-encrypted JSON Web Encryption (JWE) object with
the specified header and payload.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decrypt(JWEDecrypterMulti decrypter)
Decrypts this JWE object with the specified decrypter.
|
void |
encrypt(JWEEncrypterMulti encrypter)
Encrypts this JWE object with the specified encrypter.
|
Base64URL |
getAuthTag()
Returns the authentication tag of this JWE object.
|
Base64URL |
getCipherText()
Returns the cipher text of this JWE object.
|
JWEHeader |
getHeader()
Returns the header of this JOSE object.
|
Base64URL |
getIV()
Returns the initialisation vector (IV) of this JWE object.
|
List<JWERecipient> |
getRecipients()
Returns the recipients of this JWE object.
|
JWEObjectJSON.State |
getState()
Returns the state of this JWE object.
|
static JWEObjectJSON |
parse(Map<String,Object> jsonObject)
Parses a JWE object from the map.
|
static JWEObjectJSON |
parse(String s)
Parses a JWE object from the specified string in json form.
|
String |
serialize()
Serialises this JWE object to General JSON format.
|
Map<String,Object> |
toFlattenedJSONObject()
Returns a Flattened JSON object representation of the JOSE Object.
|
Map<String,Object> |
toGeneralJSONObject()
Returns a General JSON object representation of the JOSE Object.
|
getParsedParts, getParsedString, getPayload, setParsedParts, setPayload, splitpublic JWEObjectJSON(JWEHeader header, Payload payload)
unencrypted.header - The JWE header. Must not be null.payload - The payload. Must not be null.public JWEObjectJSON(Base64URL header, List<JWERecipient> recipients, Base64URL iv, Base64URL ciphertext, Base64URL tag) throws ParseException
encrypted.header - The JWE Protected header. Must not be null.recipients - The recipients array. Empty or null if none.iv - The initialisation vector. Empty or null if none.ciphertext - The cipher text. Must not be null.tag - The authentication tag. Empty of null if none.ParseException - If parsing of the serialised parts failed.public JWEHeader getHeader()
JOSEObjectgetHeader in class JOSEObjectpublic List<JWERecipient> getRecipients()
null if not
applicable or the JWE object has not been encrypted yet.public Base64URL getIV()
null if not
applicable or the JWE object has not been encrypted yet.public Base64URL getCipherText()
null if the JWE object has not been
encrypted yet.public Base64URL getAuthTag()
null if not applicable or
the JWE object has not been encrypted yet.public JWEObjectJSON.State getState()
public void encrypt(JWEEncrypterMulti encrypter) throws JOSEException
unencrypted state.encrypter - The JWE encrypter. Must not be null.IllegalStateException - If the JWE object is not in an
unencrypted
state.JOSEException - If the JWE object couldn't be
encrypted.public void decrypt(JWEDecrypterMulti decrypter) throws JOSEException
encrypted state.decrypter - The JWE decrypter. Must not be null.IllegalStateException - If the JWE object is not in an
encrypted
state.JOSEException - If the JWE object couldn't be
decrypted.public String serialize()
serialize in class JOSEObjectIllegalStateException - If the JWS object is not in a
signed or
verified state.public static JWEObjectJSON parse(String s) throws ParseException
JWEObjectJSON.State.ENCRYPTED state.
NOTE: Supports only General Serialization Syntaxs - The string to parse. Must not be null.ParseException - If the string couldn't be parsed to a valid
JWE object.public static JWEObjectJSON parse(Map<String,Object> jsonObject) throws ParseException
JWEObjectJSON.State.ENCRYPTED state.
NOTE: Supports only General Serialization SyntaxjsonObject - The json map. Must not be null.ParseException - If the string couldn't be parsed to a valid
JWE object.public Map<String,Object> toGeneralJSONObject()
JSONSerializabletoGeneralJSONObject in interface JSONSerializablepublic Map<String,Object> toFlattenedJSONObject()
JSONSerializabletoFlattenedJSONObject in interface JSONSerializableCopyright © 2021 Connect2id Ltd.. All rights reserved.