public class JWSHeader extends CommonSEHeader implements ReadOnlyJWSHeader
Supports all reserved header parameters
of the JWS specification:
The header may also carry custom parameters;
these will be serialised and parsed along the reserved ones.
Example header of a JSON Web Signature (JWS) object using the
HMAC SHA-256 algorithm:
{
"alg" : "HS256"
}
| Constructor and Description |
|---|
JWSHeader(JWSAlgorithm alg)
Creates a new JSON Web Signature (JWS) header.
|
| Modifier and Type | Method and Description |
|---|---|
JWSAlgorithm |
getAlgorithm()
Gets the algorithm (
alg) 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 JWS headers.
|
static JWSHeader |
parse(Base64URL base64URL)
Parses a JWS header from the specified Base64URL.
|
static JWSHeader |
parse(net.minidev.json.JSONObject json)
Parses a JWS header from the specified JSON object.
|
static JWSHeader |
parse(java.lang.String s)
Parses a JWS header from the specified JSON string.
|
void |
setCustomParameter(java.lang.String name,
java.lang.Object value)
Sets a custom (non-reserved) parameter.
|
getJWK, getJWKURL, getKeyID, getX509CertChain, getX509CertThumbprint, getX509CertURL, parseX509CertChain, setJWK, setJWKURL, setKeyID, setX509CertChain, setX509CertThumbprint, setX509CertURL, toJSONObjectgetContentType, 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, toBase64URL, toJSONObjectpublic JWSHeader(JWSAlgorithm alg)
alg - The JWS algorithm. Must not be null.public static java.util.Set<java.lang.String> getReservedParameterNames()
public JWSAlgorithm getAlgorithm()
ReadOnlyJWSHeaderalg) parameter.getAlgorithm in interface ReadOnlyHeadergetAlgorithm in interface ReadOnlyJWSHeaderpublic 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 static JWSHeader 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 JWS header.public static JWSHeader 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 JWS header.public static JWSHeader 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 JWS header.Copyright © 2013 NimbusDS. All Rights Reserved.