public abstract class JOSEObject extends Object implements Serializable
alg=none
), JSON Web
Signature (JWS) secured and JSON Web Encryption (JWE) secured objects.Modifier and Type | Field and Description |
---|---|
static String |
MIME_TYPE_COMPACT
The MIME type of JOSE objects serialised to a compact form:
application/jose; charset=UTF-8 |
static String |
MIME_TYPE_JS
The MIME type of JOSE objects serialised to a JSON object form:
application/jose+json; charset=UTF-8 |
Modifier | Constructor and Description |
---|---|
protected |
JOSEObject()
Creates a new JOSE object.
|
protected |
JOSEObject(Payload payload)
Creates a new JOSE object with the specified payload.
|
Modifier and Type | Method and Description |
---|---|
abstract Header |
getHeader()
Returns the header of this JOSE object.
|
Base64URL[] |
getParsedParts()
Returns the original parsed Base64URL parts used to create this JOSE
object.
|
String |
getParsedString()
Returns the original parsed string used to create this JOSE object.
|
Payload |
getPayload()
Returns the payload of this JOSE object.
|
static JOSEObject |
parse(String s)
Parses a JOSE object from the specified string in compact format.
|
abstract String |
serialize()
Serialises this JOSE object to its compact format consisting of
Base64URL-encoded parts delimited by period ('.') characters.
|
protected void |
setParsedParts(Base64URL... parts)
Sets the original parsed Base64URL parts used to create this JOSE
object.
|
protected void |
setPayload(Payload payload)
Sets the payload of this JOSE object.
|
static Base64URL[] |
split(String s)
Splits a compact serialised JOSE object into its Base64URL-encoded
parts.
|
public static final String MIME_TYPE_COMPACT
application/jose; charset=UTF-8
public static final String MIME_TYPE_JS
application/jose+json; charset=UTF-8
protected JOSEObject()
protected JOSEObject(Payload payload)
payload
- The payload, null
if not available (e.g for
an encrypted JWE object).public abstract Header getHeader()
protected void setPayload(Payload payload)
payload
- The payload, null
if not available (e.g. for
an encrypted JWE object).public Payload getPayload()
null
if not available (for an encrypted
JWE object that hasn't been decrypted).protected void setParsedParts(Base64URL... parts)
parts
- The original Base64URL parts used to creates this JOSE
object, null
if the object was created from
scratch. The individual parts may be empty or
null
to indicate a missing part.public Base64URL[] getParsedParts()
null
if the object was created from scratch.
The individual parts may be empty or null
to
indicate a missing part.public String getParsedString()
null
if the object was creates from scratch.getParsedParts()
public abstract String serialize()
IllegalStateException
- If the JOSE object is not in a state
that permits serialisation.public static Base64URL[] split(String s) throws ParseException
s
- The compact serialised JOSE object to split. Must not be
null
.ParseException
- If the specified string couldn't be split
into three or five Base64URL-encoded parts.public static JOSEObject parse(String s) throws ParseException
s
- The string to parse. Must not be null
.PlainObject
, JWSObject
or
JWEObject
instance.ParseException
- If the string couldn't be parsed to a valid
unsecured, JWS or JWE object.Copyright © 2017 Connect2id Ltd.. All rights reserved.