|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nimbusds.jose.JOSEObject com.nimbusds.jose.JWEObject
@ThreadSafe public class JWEObject
JSON Web Encryption (JWE) object. This class is thread-safe.
Nested Class Summary | |
---|---|
static class |
JWEObject.State
Enumeration of the states of a JSON Web Encryption (JWE) object. |
Constructor Summary | |
---|---|
JWEObject(Base64URL firstPart,
Base64URL secondPart,
Base64URL thirdPart,
Base64URL fourthPart,
Base64URL fifthPart)
Creates a new encrypted JSON Web Encryption (JWE) object with the specified serialised parts. |
|
JWEObject(JWEHeader header,
Payload payload)
Creates a new to-be-encrypted JSON Web Encryption (JWE) object with the specified header and payload. |
Method Summary | |
---|---|
void |
decrypt(JWEDecrypter decrypter)
Decrypts this JWE object with the specified decrypter. |
void |
encrypt(JWEEncrypter encrypter)
Encrypts this JWE object with the specified encrypter. |
Base64URL |
getCipherText()
Gets the cipher text of this JWE object. |
Base64URL |
getEncryptedKey()
Gets the encrypted key of this JWE object. |
ReadOnlyJWEHeader |
getHeader()
Gets the header of this JOSE object. |
Base64URL |
getInitializationVector()
Gets the initialisation vector (IV) of this JWE object. |
Base64URL |
getIntegrityValue()
Gets the integrity value of this JWE object. |
JWEObject.State |
getState()
Gets the state of this JWE object. |
static JWEObject |
parse(String s)
Parses a JWE object from the specified string in compact form. |
String |
serialize()
Serialises this JWE object to its compact format consisting of Base64URL-encoded parts delimited by period ('.') characters. |
Methods inherited from class com.nimbusds.jose.JOSEObject |
---|
getParsedParts, getParsedString, getPayload, setParsedParts, setPayload, split |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JWEObject(JWEHeader header, Payload payload)
unencrypted
.
header
- The JWE header. Must not be null
.payload
- The payload. Must not be null
.public JWEObject(Base64URL firstPart, Base64URL secondPart, Base64URL thirdPart, Base64URL fourthPart, Base64URL fifthPart) throws ParseException
encrypted
.
firstPart
- The first part, corresponding to the JWE header.
Must not be null
.secondPart
- The second part, corresponding to the encrypted
key. Empty or null
if none.thirdPart
- The third part, corresponding to the
initialisation vector. Empty or null
if
none.fourthPart
- The fourth part, corresponding to the cipher text.
Must not be null
.fifthPart
- The fifth part, corresponding to the integrity
value. Empty of null
if none.
ParseException
- If parsing of the serialised parts failed.Method Detail |
---|
public ReadOnlyJWEHeader getHeader()
JOSEObject
getHeader
in class JOSEObject
public Base64URL getEncryptedKey()
null
not applicable or the JWE
object has not been encrypted yet.public Base64URL getInitializationVector()
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 getIntegrityValue()
null
if not applicable or the
JWE object has not been encrypted yet.public JWEObject.State getState()
public void encrypt(JWEEncrypter 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(JWEDecrypter 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()
encrypted
or
decrypted
state.
[header-base64url].[encryptedKey-base64url].[iv-base64url].[cipherText-base64url].[integrityValue-base64url]
serialize
in class JOSEObject
IllegalStateException
- If the JWE object is not in a
encrypted
or
decrypted
state
.public static JWEObject parse(String s) throws ParseException
JWEObject.State.ENCRYPTED
state.
s
- The string to parse. Must not be null
.
ParseException
- If the string couldn't be parsed to a valid
JWE object.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |