public class SigPIdHeader extends Object implements ProtectedHeader
The sigPId is a protected header defined in the JAdES specification. It contains either an explicit identifier for the signature policy or an indication that there is an implied signature policy. The syntax of the header is:
"sigPId":{ "type": "object", "properties": { "id": {"$ref": "#/definitions/oId"}, "digAlg": {"type": "string"}, "digVal": {"type": "string","contentEncoding": "base64"}, "digPSp": {"type": "boolean"}, "sigPQuals": {"type": "array", "items": {"$ref": "#/definitions/sigPQual"}, "minItems": 1} }, "required": ["id"], "additionalProperties": false }
For the contents of the sigPId header, see JAdESOID and SigPQual.
Modifier and Type | Field and Description |
---|---|
static String |
KEY
The json key of the header
|
Constructor and Description |
---|
SigPIdHeader(JAdESOID id)
Creates a sigPId header with only the provided oID.
|
Modifier and Type | Method and Description |
---|---|
void |
addSigPQual(JAdESOID spDSpec)
Adds a spDSpec to the sigPQuals array.
|
void |
addSigPQual(SpURI spURI)
Adds a SpURI to the sigPQuals array.
|
void |
addSigPQual(SpUserNotice spUserNotice)
Adds a SpUserNotice to the sigPQuals array.
|
DigestAlgorithmIdentifiers |
getDigAlg()
Returns the digAlg member.
|
String |
getDigVal()
Returns the digVal member.
|
JAdESOID |
getId()
Returns the id member.
|
String |
getJsonKey()
Returns the json key of the sigPId header.
|
List<JAdESOID> |
getSpDSpecs()
Returns all SpDSpecs as unmodifiable list.
|
List<SpURI> |
getSpURIS()
Returns all SpURIs as unmodifiable list.
|
List<SpUserNotice> |
getSpUserNotices()
Returns all SpUserNotices as unmodifiable list.
|
boolean |
isDigPSp()
Returns the sigPSp member.
|
void |
setDigest(DigestAlgorithmIdentifiers digAlg,
byte[] digVal)
Sets the digAlg and digVal member of the sigPId.
|
void |
setDigest(DigestAlgorithmIdentifiers digAlg,
InputStream sigPolDoc)
Sets the digAlg and digVal member of the sigPId.
|
void |
writeToJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator)
Writes the Json representation of the sigPId header to the provided JsonGenerator.
|
public static final String KEY
public SigPIdHeader(JAdESOID id)
id
- an oIDpublic void setDigest(DigestAlgorithmIdentifiers digAlg, byte[] digVal)
digAlg
- the digAlgdigVal
- the digestpublic void setDigest(DigestAlgorithmIdentifiers digAlg, InputStream sigPolDoc) throws IOException
digAlg
- the digAlgsigPolDoc
- the InputStream to read the signature policy doc fromIOException
- if not possible to read from streampublic void addSigPQual(SpURI spURI)
spURI
- an instance of SpURIpublic void addSigPQual(SpUserNotice spUserNotice)
spUserNotice
- an instance of SpUserNoticepublic void addSigPQual(JAdESOID spDSpec)
spDSpec
- an instance of JAdESOIDpublic DigestAlgorithmIdentifiers getDigAlg()
public String getDigVal()
public boolean isDigPSp()
false
.true
if present and set to true
. false
otherwise.public List<SpUserNotice> getSpUserNotices()
public List<SpURI> getSpURIS()
public List<JAdESOID> getSpDSpecs()
public void writeToJson(com.fasterxml.jackson.core.JsonGenerator jsonGenerator) throws IOException
Writes the Json representation of the sigPId header to the provided JsonGenerator.
writeToJson
in interface ProtectedHeader
jsonGenerator
- a JsonGenerator for serializingIOException
- if it is not possible to write to the provided sourcepublic String getJsonKey()
getJsonKey
in interface JWSHeader
"sigPId"
Copyright © 2022 Stiftung SIC. All rights reserved.