Class XAdESSignatureProperties
java.lang.Object
org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties
- All Implemented Interfaces:
XmlSignatureProperties
- Direct Known Subclasses:
DefaultXAdESSignatureProperties
Implementation of the XAdES-BES and XAdES-EPES properties defined in
http://www.etsi.org/deliver/etsi_ts%5C101900_101999%5C101903%5C01.04 .02_60%5Cts_101903v010402p.pdf. XAdES-T and
XAdES-C is not implemented.
You have to overwrite the method getSigningCertificate()
or getSigningCertificateChain()
if you
want to have a 'SigningCertificate' element in your XML Signature.
Further limitations:
- No support for the 'QualifyingPropertiesReference' element (see section 6.3.2 of spec).
- No support for the 'Transforms' element contained in the 'SignaturePolicyId' element contained in 'SignaturePolicyIdentifier' element
- No support of the 'CounterSignature' element --> no support for the 'UnsignedProperties' element
- A 'CommitmentTypeIndication' element contains always the 'AllSignedDataObjects' element. The 'ObjectReference' element within the 'CommitmentTypeIndication' element is not supported.
- The 'AllDataObjectsTimeStamp' element is not supported (it requires a time authority)
- The 'IndividualDataObjectsTimeStamp' element is not supported (it requires a time authority)
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.component.xmlsecurity.api.XmlSignatureProperties
XmlSignatureProperties.Input, XmlSignatureProperties.Output
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCertificate
(X509Certificate cert, Element signedCertificate, Document doc, int index, XmlSignatureProperties.Input input) protected void
addCommitmentTypeIndication
(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) protected String
addDataObjectFormat
(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) protected void
addSignaturePolicyIdentifier
(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected void
addSignatureProductionPlace
(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) protected String
addSignedDataObjectProperties
(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected void
addSignedSignatureProperties
(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected void
addSignerRole
(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) protected void
addSigningCertificate
(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected void
addSigningTime
(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected String
calculateDigest
(String algorithm, byte[] bytes) protected Element
createChildFromXmlFragmentOrText
(Document doc, XmlSignatureProperties.Input input, String localElementName, String errorMessage, String elementOrText) protected Element
createDigSigElement
(String localName, Document doc, String prefixForXmlSignatureNamespace) protected Element
createElement
(String localName, Document doc, XmlSignatureProperties.Input input) protected Element
createElementNS
(Document doc, XmlSignatureProperties.Input input, String elementName) protected String
findNamespace
(org.apache.camel.Message message) protected String
findPrefix
(org.apache.camel.Message message) get
(XmlSignatureProperties.Input input) Returns further configuration objects for the XML signatureprotected String
getMessageDigestAlgorithm
(String xmlSigDigestMethod, String errorMessage) protected X509Certificate
Returns the signing certificate.protected X509Certificate[]
Returns the signing certificate.protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
boolean
protected void
replacePrefix
(Element el, XmlSignatureProperties.Input input) protected void
replacePrefixes
(Document qualifierDoc, XmlSignatureProperties.Input input) protected void
replacePrefixForNode
(Node node, XmlSignatureProperties.Input input) void
setAddSigningTime
(boolean addSigningTime) protected void
setAttribute
(Element element, String attrName, String value) void
setCommitmentTypeId
(String commitmentTypeId) void
setCommitmentTypeIdDescription
(String commitmentTypeIdDescription) void
setCommitmentTypeIdDocumentationReferences
(List<String> commitmentTypeIdDocumentationReferences) Sets the documentation references for the Commitment Type ID:void
setCommitmentTypeIdQualifier
(String commitmentTypeIdQualifier) Qualifier for the Commitment Type ID.void
setCommitmentTypeQualifiers
(List<String> commitmentTypeQualifiers) List of additional qualifying information on the commitment.void
setDataObjectFormatDescription
(String dataObjectFormatDescription) void
setDataObjectFormatIdentifier
(String dataObjectFormatIdentifier) void
setDataObjectFormatIdentifierDescription
(String dataObjectFormatIdentifierDescription) void
setDataObjectFormatIdentifierDocumentationReferences
(List<String> dataObjectFormatIdentifierDocumentationReferences) Sets the documentation references of the data object format identifier.void
setDataObjectFormatIdentifierQualifier
(String dataObjectFormatIdentifierQualifier) Qualifier for the Format Identifier.void
setDataObjectFormatMimeType
(String dataObjectFormatMimeType) void
setDigestAlgorithmForSigningCertificate
(String digestAlgorithm) Digest Algorithm for creating the digest of the signing certificate.protected void
setIdAttributeFromHeader
(String header, Element element, XmlSignatureProperties.Input input) void
setNamespace
(String namespace) void
void
setSignaturePolicy
(String signaturePolicy) Signature Policy.void
setSignaturePolicyDigestAlgorithm
(String signaturePolicyDigestAlgorithm) Digest Algorithm for creating the digest of the signature policy document.void
setSignaturePolicyDigestValue
(String signaturePolicyDigestValue) Digest value for the signature policy base 64 encoded.void
setSignatureProductionPlaceCity
(String signatureProductionPlaceCity) void
setSignatureProductionPlaceCountryName
(String signatureProductionPlaceCountryName) void
setSignatureProductionPlacePostalCode
(String signatureProductionPlacePostalCode) void
setSignatureProductionPlaceStateOrProvince
(String signatureProductionPlaceStateOrProvince) void
setSignerCertifiedRoles
(List<XAdESEncapsulatedPKIData> signerCertifiedRoles) Sets the certified roles.void
setSignerClaimedRoles
(List<String> signerClaimedRoles) Sets the claimed roles list.void
setSigningCertificateURIs
(List<String> signingCertificateURIs) URIs of the signing certificate or signing certificate chain.void
setSigPolicyId
(String sigPolicyId) Identifier must be specified ifgetSignaturePolicy()
equals "ExplicitId".void
setSigPolicyIdDescription
(String sigPolicyIdDescription) void
setSigPolicyIdDocumentationReferences
(List<String> sigPolicyIdDocumentationReferences) Sets the documentation references of the signature policy.void
setSigPolicyIdQualifier
(String sigPolicyIdQualifier) Qualifier for the Signature Policy Identifier.void
setSigPolicyQualifiers
(List<String> sigPolicyQualifiers) Sets the signature policy qualifiers.
-
Field Details
-
HTTP_URI_ETSI_ORG_01903_V1_3_2
- See Also:
-
HTTP_URI_ETSI_ORG_01903_V1_1_1
- See Also:
-
HTTP_URI_ETSI_ORG_01903_V1_2_2
- See Also:
-
SIG_POLICY_NONE
- See Also:
-
SIG_POLICY_IMPLIED
- See Also:
-
SIG_POLICY_EXPLICIT_ID
- See Also:
-
-
Constructor Details
-
XAdESSignatureProperties
public XAdESSignatureProperties()
-
-
Method Details
-
isAddSigningTime
public boolean isAddSigningTime() -
setAddSigningTime
public void setAddSigningTime(boolean addSigningTime) -
getNamespace
-
setNamespace
-
findNamespace
-
getPrefix
-
setPrefix
-
findPrefix
-
setSigningCertificateURIs
URIs of the signing certificate or signing certificate chain. For the sining certificate the first URI is taken. If there is a signing certificate chain specified, then the URIs are assigned to the certificates in the chain in the order given in the provided list. You have to specify an empty entry (null or empty srting), if no URI should be assigned to a specific certificate in the list. If you specify an empty list, then no URIs are assigned.- Throws:
IllegalArgumentException
- if the parameter isnull
or one of the URIs isnull
-
getSigningCertificateURIs
-
getDigestAlgorithmForSigningCertificate
-
setDigestAlgorithmForSigningCertificate
Digest Algorithm for creating the digest of the signing certificate. Possible values: "http://www.w3.org/2000/09/xmldsig#sha1", "http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#sha384", "http://www.w3.org/2001/04/xmlenc#sha512". Default value is "http://www.w3.org/2001/04/xmlenc#sha256". -
getSignaturePolicy
-
setSignaturePolicy
Signature Policy. Possible values:SIG_POLICY_NONE
,SIG_POLICY_IMPLIED
,SIG_POLICY_EXPLICIT_ID
. Default value isSIG_POLICY_NONE
. -
getSigPolicyId
-
setSigPolicyId
Identifier must be specified ifgetSignaturePolicy()
equals "ExplicitId". Must be an URI -
getSigPolicyIdQualifier
-
setSigPolicyIdQualifier
Qualifier for the Signature Policy Identifier. Possible values arenull
(which means no Qualifier element is created), "OIDAsURI", or "OIDAsURN". Default value isnull
. If the identifier is an OID then a qualifier must be set. -
getSigPolicyIdDescription
-
setSigPolicyIdDescription
-
getSigPolicyIdDocumentationReferences
-
setSigPolicyIdDocumentationReferences
Sets the documentation references of the signature policy.- Throws:
IllegalArgumentException
- if the parameter isnull
or one of the documentation references isnull
or empty
-
getSignaturePolicyDigestAlgorithm
-
setSignaturePolicyDigestAlgorithm
Digest Algorithm for creating the digest of the signature policy document. Possible values: "http://www.w3.org/2000/09/xmldsig#sha1", "http://www.w3.org/2001/04/xmlenc#sha256", "http://www.w3.org/2001/04/xmldsig-more#sha384", "http://www.w3.org/2001/04/xmlenc#sha512". Default value is "http://www.w3.org/2001/04/xmlenc#sha256". -
getSignaturePolicyDigestValue
-
setSignaturePolicyDigestValue
Digest value for the signature policy base 64 encoded. -
getSigPolicyQualifiers
-
setSigPolicyQualifiers
Sets the signature policy qualifiers. Each qualifier can be a text or a XML fragment with the root element 'SigPolicyQualifier' with the XAdES namespace.- Throws:
IllegalArgumentException
- if the input parameter isnull
, or one of the qualifiers isnull
or empty
-
getDataObjectFormatDescription
-
setDataObjectFormatDescription
-
getDataObjectFormatMimeType
-
setDataObjectFormatMimeType
-
getDataObjectFormatIdentifier
-
setDataObjectFormatIdentifier
-
getDataObjectFormatIdentifierQualifier
-
setDataObjectFormatIdentifierQualifier
Qualifier for the Format Identifier. Possible values arenull
(which means no Qualifier element is created), "OIDAsURI", or "OIDAsURN". Default value isnull
. If the identifier is an OID then a qualifier must be set. -
getDataObjectFormatIdentifierDescription
-
setDataObjectFormatIdentifierDescription
-
getDataObjectFormatIdentifierDocumentationReferences
-
setDataObjectFormatIdentifierDocumentationReferences
public void setDataObjectFormatIdentifierDocumentationReferences(List<String> dataObjectFormatIdentifierDocumentationReferences) Sets the documentation references of the data object format identifier.- Throws:
IllegalArgumentException
- if the parameter isnull
or one of the documentation references isnull
or empty
-
getSignerClaimedRoles
-
setSignerClaimedRoles
Sets the claimed roles list. A role can be either a text or a XML fragment with the root element 'ClaimedRole' with the XAdES namespace.- Throws:
IllegalArgumentException
- if signerClaimedRoles isnull
, or if one of the roles isnull
or empty
-
getSignerCertifiedRoles
-
setSignerCertifiedRoles
Sets the certified roles.- Throws:
IllegalArgumentException
- if signerCertifiedRoles isnull
-
getSignatureProductionPlaceCity
-
setSignatureProductionPlaceCity
-
getSignatureProductionPlaceStateOrProvince
-
setSignatureProductionPlaceStateOrProvince
public void setSignatureProductionPlaceStateOrProvince(String signatureProductionPlaceStateOrProvince) -
getSignatureProductionPlacePostalCode
-
setSignatureProductionPlacePostalCode
-
getSignatureProductionPlaceCountryName
-
setSignatureProductionPlaceCountryName
-
getCommitmentTypeId
-
setCommitmentTypeId
-
getCommitmentTypeIdQualifier
-
setCommitmentTypeIdQualifier
Qualifier for the Commitment Type ID. Possible values arenull
(which means no Qualifier element is created), "OIDAsURI", or "OIDAsURN". Default value isnull
. If the identifier is an OID then a qualifier must be set. -
getCommitmentTypeIdDescription
-
setCommitmentTypeIdDescription
-
getCommitmentTypeIdDocumentationReferences
-
setCommitmentTypeIdDocumentationReferences
public void setCommitmentTypeIdDocumentationReferences(List<String> commitmentTypeIdDocumentationReferences) Sets the documentation references for the Commitment Type ID:- Throws:
IllegalArgumentException
- if the parameter isnull
or a documentation reference isnull
or empty
-
getCommitmentTypeQualifiers
-
setCommitmentTypeQualifiers
List of additional qualifying information on the commitment. Each list element can be a text or an XML fragment with the root element 'CommitmentTypeQualifier' with the XAdES namespace.- Throws:
IllegalArgumentException
- if the input parameter isnull
, or one qualifier isnull
or empty
-
get
Description copied from interface:XmlSignatureProperties
Returns further configuration objects for the XML signature- Specified by:
get
in interfaceXmlSignatureProperties
- Parameters:
input
- input- Returns:
- output must not be
null
- Throws:
Exception
- if an error occurs during creating the output
-
setAttribute
-
setIdAttributeFromHeader
protected void setIdAttributeFromHeader(String header, Element element, XmlSignatureProperties.Input input) -
addSignedDataObjectProperties
protected String addSignedDataObjectProperties(Document doc, Element signedProperties, XmlSignatureProperties.Input input) throws XmlSignatureException, IOException, ParserConfigurationException -
isAddSignedDataObjectPropeties
protected boolean isAddSignedDataObjectPropeties() -
addCommitmentTypeIndication
protected void addCommitmentTypeIndication(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) throws IOException, ParserConfigurationException, XmlSignatureException -
isAddCommitmentType
protected boolean isAddCommitmentType() -
addDataObjectFormat
protected String addDataObjectFormat(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) -
isAddDataObjectFormat
protected boolean isAddDataObjectFormat() -
addSignedSignatureProperties
protected void addSignedSignatureProperties(Document doc, Element signedProperties, XmlSignatureProperties.Input input) throws Exception - Throws:
Exception
-
isAddSignedSignatureProperties
- Throws:
Exception
-
isAddSignerRole
protected boolean isAddSignerRole() -
addSignatureProductionPlace
protected void addSignatureProductionPlace(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) -
isAddSignatureProductionPlace
protected boolean isAddSignatureProductionPlace() -
addSignerRole
protected void addSignerRole(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) throws XmlSignatureException, IOException, ParserConfigurationException -
addSignaturePolicyIdentifier
protected void addSignaturePolicyIdentifier(Document doc, Element signedProperties, XmlSignatureProperties.Input input) throws XmlSignatureException, IOException, ParserConfigurationException -
createChildFromXmlFragmentOrText
protected Element createChildFromXmlFragmentOrText(Document doc, XmlSignatureProperties.Input input, String localElementName, String errorMessage, String elementOrText) throws IOException, ParserConfigurationException, XmlSignatureException -
replacePrefixes
-
getChildElements
-
replacePrefix
-
replacePrefixForNode
-
isAddSignaturePolicy
protected boolean isAddSignaturePolicy() -
addSigningCertificate
protected void addSigningCertificate(Document doc, Element signedProperties, XmlSignatureProperties.Input input) throws Exception - Throws:
Exception
-
getSigningCertificate
Returns the signing certificate. If you want to have a "SigningCertificate" element then either this method or the methodgetSigningCertificateChain()
must return a value which is different fromnull
or an empty array.This implementation returns
null
- Throws:
Exception
-
getSigningCertificateChain
Returns the signing certificate. If you want to have a "SigningCertificate" element then either this method or the methodgetSigningCertificate()
must return a value.This implementation returns
null
- Throws:
Exception
-
addSigningTime
protected void addSigningTime(Document doc, Element signedProperties, XmlSignatureProperties.Input input) -
addCertificate
protected void addCertificate(X509Certificate cert, Element signedCertificate, Document doc, int index, XmlSignatureProperties.Input input) throws CertificateEncodingException, NoSuchAlgorithmException, XmlSignatureException -
getMessageDigestAlgorithm
protected String getMessageDigestAlgorithm(String xmlSigDigestMethod, String errorMessage) throws XmlSignatureException - Throws:
XmlSignatureException
-
calculateDigest
- Throws:
NoSuchAlgorithmException
-
createElementNS
protected Element createElementNS(Document doc, XmlSignatureProperties.Input input, String elementName) -
createDigSigElement
-
createElement
-