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 voidaddCertificate(X509Certificate cert, Element signedCertificate, Document doc, int index, XmlSignatureProperties.Input input) protected voidaddCommitmentTypeIndication(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) protected StringaddDataObjectFormat(Element signedDataObjectProperties, Document doc, XmlSignatureProperties.Input input) protected voidaddSignaturePolicyIdentifier(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected voidaddSignatureProductionPlace(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) protected StringaddSignedDataObjectProperties(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected voidaddSignedSignatureProperties(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected voidaddSignerRole(Document doc, Element signedSignatureProperties, XmlSignatureProperties.Input input) protected voidaddSigningCertificate(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected voidaddSigningTime(Document doc, Element signedProperties, XmlSignatureProperties.Input input) protected StringcalculateDigest(String algorithm, byte[] bytes) protected ElementcreateChildFromXmlFragmentOrText(Document doc, XmlSignatureProperties.Input input, String localElementName, String errorMessage, String elementOrText) protected ElementcreateDigSigElement(String localName, Document doc, String prefixForXmlSignatureNamespace) protected ElementcreateElement(String localName, Document doc, XmlSignatureProperties.Input input) protected ElementcreateElementNS(Document doc, XmlSignatureProperties.Input input, String elementName) protected StringfindNamespace(org.apache.camel.Message message) protected StringfindPrefix(org.apache.camel.Message message) get(XmlSignatureProperties.Input input) Returns further configuration objects for the XML signatureprotected StringgetMessageDigestAlgorithm(String xmlSigDigestMethod, String errorMessage) protected X509CertificateReturns the signing certificate.protected X509Certificate[]Returns the signing certificate.protected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanbooleanprotected voidreplacePrefix(Element el, XmlSignatureProperties.Input input) protected voidreplacePrefixes(Document qualifierDoc, XmlSignatureProperties.Input input) protected voidreplacePrefixForNode(Node node, XmlSignatureProperties.Input input) voidsetAddSigningTime(boolean addSigningTime) protected voidsetAttribute(Element element, String attrName, String value) voidsetCommitmentTypeId(String commitmentTypeId) voidsetCommitmentTypeIdDescription(String commitmentTypeIdDescription) voidsetCommitmentTypeIdDocumentationReferences(List<String> commitmentTypeIdDocumentationReferences) Sets the documentation references for the Commitment Type ID:voidsetCommitmentTypeIdQualifier(String commitmentTypeIdQualifier) Qualifier for the Commitment Type ID.voidsetCommitmentTypeQualifiers(List<String> commitmentTypeQualifiers) List of additional qualifying information on the commitment.voidsetDataObjectFormatDescription(String dataObjectFormatDescription) voidsetDataObjectFormatIdentifier(String dataObjectFormatIdentifier) voidsetDataObjectFormatIdentifierDescription(String dataObjectFormatIdentifierDescription) voidsetDataObjectFormatIdentifierDocumentationReferences(List<String> dataObjectFormatIdentifierDocumentationReferences) Sets the documentation references of the data object format identifier.voidsetDataObjectFormatIdentifierQualifier(String dataObjectFormatIdentifierQualifier) Qualifier for the Format Identifier.voidsetDataObjectFormatMimeType(String dataObjectFormatMimeType) voidsetDigestAlgorithmForSigningCertificate(String digestAlgorithm) Digest Algorithm for creating the digest of the signing certificate.protected voidsetIdAttributeFromHeader(String header, Element element, XmlSignatureProperties.Input input) voidsetNamespace(String namespace) voidvoidsetSignaturePolicy(String signaturePolicy) Signature Policy.voidsetSignaturePolicyDigestAlgorithm(String signaturePolicyDigestAlgorithm) Digest Algorithm for creating the digest of the signature policy document.voidsetSignaturePolicyDigestValue(String signaturePolicyDigestValue) Digest value for the signature policy base 64 encoded.voidsetSignatureProductionPlaceCity(String signatureProductionPlaceCity) voidsetSignatureProductionPlaceCountryName(String signatureProductionPlaceCountryName) voidsetSignatureProductionPlacePostalCode(String signatureProductionPlacePostalCode) voidsetSignatureProductionPlaceStateOrProvince(String signatureProductionPlaceStateOrProvince) voidsetSignerCertifiedRoles(List<XAdESEncapsulatedPKIData> signerCertifiedRoles) Sets the certified roles.voidsetSignerClaimedRoles(List<String> signerClaimedRoles) Sets the claimed roles list.voidsetSigningCertificateURIs(List<String> signingCertificateURIs) URIs of the signing certificate or signing certificate chain.voidsetSigPolicyId(String sigPolicyId) Identifier must be specified ifgetSignaturePolicy()equals "ExplicitId".voidsetSigPolicyIdDescription(String sigPolicyIdDescription) voidsetSigPolicyIdDocumentationReferences(List<String> sigPolicyIdDocumentationReferences) Sets the documentation references of the signature policy.voidsetSigPolicyIdQualifier(String sigPolicyIdQualifier) Qualifier for the Signature Policy Identifier.voidsetSigPolicyQualifiers(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 isnullor 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 isnullor one of the documentation references isnullor 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 isnullor 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 isnullor one of the documentation references isnullor 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 isnullor 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 isnullor a documentation reference isnullor 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 isnullor empty
-
get
Description copied from interface:XmlSignaturePropertiesReturns further configuration objects for the XML signature- Specified by:
getin 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 fromnullor 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
-