com.nimbusds.jose
Class CommonSEHeader

java.lang.Object
  extended by com.nimbusds.jose.Header
      extended by com.nimbusds.jose.CommonSEHeader
All Implemented Interfaces:
ReadOnlyCommonSEHeader, ReadOnlyHeader
Direct Known Subclasses:
JWEHeader, JWSHeader

public abstract class CommonSEHeader
extends Header
implements ReadOnlyCommonSEHeader

Common class for JWS and JWE headers.

Supports all reserved header parameters shared by the JWS and JWE specifications:

Version:
$version$ (2012-09-22)
Author:
Vladimir Dzhuvinov

Field Summary
 
Fields inherited from class com.nimbusds.jose.Header
alg
 
Constructor Summary
protected CommonSEHeader(Algorithm alg)
          Creates a new common JWS and JWE header with the specified algorithm (alg) parameter.
 
Method Summary
 JWK getJWK()
          Gets the JSON Web Key (JWK) (jwk) parameter.
 URL getJWKURL()
          Gets the JSON Web Key (JWK) Set URL (jku) parameter.
 String getKeyID()
          Gets the key ID (kid) parameter.
 Base64[] getX509CertChain()
          Gets the X.509 certificate chain parameter (x5c) corresponding to the key used to sign or encrypt the JWS/JWE object.
 Base64URL getX509CertThumbprint()
          Gets the X.509 certificate thumbprint (x5t) parameter.
 URL getX509CertURL()
          Gets the X.509 certificate URL (x5u) parameter.
protected static Base64[] parseX509CertChain(net.minidev.json.JSONArray jsonArray)
          Parses an X.509 certificate chain from the specified JSON array.
 void setJWK(JWK jwk)
          Sets the JSON Web Key (JWK) (jwk) parameter.
 void setJWKURL(URL jku)
          Sets the JSON Web Key (JWK) Set URL (jku) parameter.
 void setKeyID(String kid)
          Sets the key ID (kid) parameter.
 void setX509CertChain(Base64[] x5c)
          Sets the X.509 certificate chain parameter (x5c) corresponding to the key used to sign or encrypt the JWS/JWE object.
 void setX509CertThumbprint(Base64URL x5t)
          Sets the X.509 certificate thumbprint (x5t) parameter.
 void setX509CertURL(URL x5u)
          Sets the X.509 certificate URL (x5u) parameter.
 net.minidev.json.JSONObject toJSONObject()
          Returns a JSON object representation of the header.
 
Methods inherited from class com.nimbusds.jose.Header
getContentType, getCustomParameter, getCustomParameters, getType, parse, parseAlgorithm, setContentType, setCustomParameter, setCustomParameters, setParsedBase64URL, setType, toBase64URL, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.nimbusds.jose.ReadOnlyHeader
getAlgorithm, getContentType, getCustomParameter, getCustomParameters, getIncludedParameters, getType, toBase64URL, toString
 

Constructor Detail

CommonSEHeader

protected CommonSEHeader(Algorithm alg)
Creates a new common JWS and JWE header with the specified algorithm (alg) parameter.

Parameters:
alg - The algorithm parameter. Must not be null.
Method Detail

getJWKURL

public URL getJWKURL()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the JSON Web Key (JWK) Set URL (jku) parameter.

Specified by:
getJWKURL in interface ReadOnlyCommonSEHeader
Returns:
The JSON Web Key (JWK) Set URL parameter, null if not specified.

setJWKURL

public void setJWKURL(URL jku)
Sets the JSON Web Key (JWK) Set URL (jku) parameter.

Parameters:
jku - The JSON Web Key (JWK) Set URL parameter, null if not specified.

getJWK

public JWK getJWK()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the JSON Web Key (JWK) (jwk) parameter.

Specified by:
getJWK in interface ReadOnlyCommonSEHeader
Returns:
The JSON Web Key (JWK) parameter, null if not specified.

setJWK

public void setJWK(JWK jwk)
Sets the JSON Web Key (JWK) (jwk) parameter.

Parameters:
jwk - The JSON Web Key (JWK) (jwk) parameter, null if not specified.

getX509CertURL

public URL getX509CertURL()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the X.509 certificate URL (x5u) parameter.

Specified by:
getX509CertURL in interface ReadOnlyCommonSEHeader
Returns:
The X.509 certificate URL parameter, null if not specified.

setX509CertURL

public void setX509CertURL(URL x5u)
Sets the X.509 certificate URL (x5u) parameter.

Parameters:
x5u - The X.509 certificate URL parameter, null if not specified.

getX509CertThumbprint

public Base64URL getX509CertThumbprint()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the X.509 certificate thumbprint (x5t) parameter.

Specified by:
getX509CertThumbprint in interface ReadOnlyCommonSEHeader
Returns:
The X.509 certificate thumbprint parameter, null if not specified.

setX509CertThumbprint

public void setX509CertThumbprint(Base64URL x5t)
Sets the X.509 certificate thumbprint (x5t) parameter.

Parameters:
x5t - The X.509 certificate thumbprint parameter, null if not specified.

getX509CertChain

public Base64[] getX509CertChain()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the X.509 certificate chain parameter (x5c) corresponding to the key used to sign or encrypt the JWS/JWE object.

Specified by:
getX509CertChain in interface ReadOnlyCommonSEHeader
Returns:
The X.509 certificate chain parameter, null if not specified.

setX509CertChain

public void setX509CertChain(Base64[] x5c)
Sets the X.509 certificate chain parameter (x5c) corresponding to the key used to sign or encrypt the JWS/JWE object.

Parameters:
x5c - The X.509 certificate chain parameter, null if not specified.

getKeyID

public String getKeyID()
Description copied from interface: ReadOnlyCommonSEHeader
Gets the key ID (kid) parameter.

Specified by:
getKeyID in interface ReadOnlyCommonSEHeader
Returns:
The key ID parameter, null if not specified.

setKeyID

public void setKeyID(String kid)
Sets the key ID (kid) parameter.

Parameters:
kid - The key ID parameter, null if not specified.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
Description copied from interface: ReadOnlyHeader
Returns a JSON object representation of the header. All custom parameters are included if they serialise to a JSON entity and their names don't conflict with the reserved ones.

Specified by:
toJSONObject in interface ReadOnlyHeader
Overrides:
toJSONObject in class Header
Returns:
The JSON object representation of the header.

parseX509CertChain

protected static Base64[] parseX509CertChain(net.minidev.json.JSONArray jsonArray)
                                      throws ParseException
Parses an X.509 certificate chain from the specified JSON array.

Parameters:
jsonArray - The JSON array to parse. Must not be null.
Returns:
The X.509 certificate chain.
Throws:
ParseException - If the X.509 certificate chain couldn't be parsed.


Copyright © 2013 NimbusDS. All Rights Reserved.