Class XMLAdvancedSignature


  • public class XMLAdvancedSignature
    extends java.lang.Object
    • Field Detail

      • signedPropertiesTypeUrl

        public java.lang.String signedPropertiesTypeUrl
      • ELEMENT_SIGNATURE

        public static final java.lang.String ELEMENT_SIGNATURE
        See Also:
        Constant Field Values
      • ELEMENT_SIGNATURE_VALUE

        public static final java.lang.String ELEMENT_SIGNATURE_VALUE
        See Also:
        Constant Field Values
      • baseElement

        protected org.w3c.dom.Element baseElement
      • xmlSignatureFactory

        protected javax.xml.crypto.dsig.XMLSignatureFactory xmlSignatureFactory
      • digestMethod

        protected javax.xml.crypto.dsig.DigestMethod digestMethod
      • xadesNamespace

        protected java.lang.String xadesNamespace
      • xmlObjects

        protected java.util.List<javax.xml.crypto.dsig.XMLObject> xmlObjects
      • defaultXMLObjectItems

        protected java.util.List<javax.xml.crypto.XMLStructure> defaultXMLObjectItems
      • defaultXMLObjectId

        protected java.lang.String defaultXMLObjectId
      • defaultXMLObjectMimeType

        protected java.lang.String defaultXMLObjectMimeType
      • defaultXMLObjectEncoding

        protected java.lang.String defaultXMLObjectEncoding
      • signature

        protected javax.xml.crypto.dsig.XMLSignature signature
      • signContext

        protected javax.xml.crypto.dsig.dom.DOMSignContext signContext
    • Constructor Detail

      • XMLAdvancedSignature

        protected XMLAdvancedSignature​(XAdESBase xades)
    • Method Detail

      • newInstance

        public static XMLAdvancedSignature newInstance​(XAdESBase xades)
                                                throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getInstance

        public static XMLAdvancedSignature getInstance​(XAdESBase xades)
                                                throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getBaseElement

        public org.w3c.dom.Element getBaseElement()
      • getBaseDocument

        public org.w3c.dom.Document getBaseDocument()
      • setXadesNamespace

        public void setXadesNamespace​(java.lang.String xadesNamespace)
      • setSignedPropertiesTypeUrl

        public void setSignedPropertiesTypeUrl​(java.lang.String signedPropertiesTypeUrl)
      • sign

        public void sign​(java.security.cert.X509Certificate signingCert,
                         java.security.PrivateKey privateKey,
                         java.lang.String signatureMethod,
                         java.util.List refsIdList,
                         java.lang.String signatureIdPrefix)
                  throws javax.xml.crypto.MarshalException,
                         javax.xml.crypto.dsig.XMLSignatureException,
                         java.security.GeneralSecurityException,
                         javax.xml.crypto.dsig.TransformException,
                         java.io.IOException,
                         javax.xml.parsers.ParserConfigurationException,
                         org.xml.sax.SAXException
        Throws:
        javax.xml.crypto.MarshalException
        javax.xml.crypto.dsig.XMLSignatureException
        java.security.GeneralSecurityException
        javax.xml.crypto.dsig.TransformException
        java.io.IOException
        javax.xml.parsers.ParserConfigurationException
        org.xml.sax.SAXException
      • sign

        public void sign​(java.security.cert.X509Certificate certificate,
                         java.security.PrivateKey privateKey,
                         java.lang.String signatureMethod,
                         java.util.List refsIdList,
                         java.lang.String signatureIdPrefix,
                         SigningCertificateInfo signingCertInfo)
                  throws javax.xml.crypto.MarshalException,
                         javax.xml.crypto.dsig.XMLSignatureException,
                         java.security.GeneralSecurityException,
                         javax.xml.crypto.dsig.TransformException,
                         java.io.IOException,
                         javax.xml.parsers.ParserConfigurationException,
                         org.xml.sax.SAXException
        Throws:
        javax.xml.crypto.MarshalException
        javax.xml.crypto.dsig.XMLSignatureException
        java.security.GeneralSecurityException
        javax.xml.crypto.dsig.TransformException
        java.io.IOException
        javax.xml.parsers.ParserConfigurationException
        org.xml.sax.SAXException
      • setWrappedKeyStorePlace

        public void setWrappedKeyStorePlace​(WrappedKeyStorePlace wrappedKeyStorePlace)
      • getXMLObjects

        public java.util.List<javax.xml.crypto.dsig.XMLObject> getXMLObjects()
      • setXmlWrappedKeyInfo

        public void setXmlWrappedKeyInfo​(XmlWrappedKeyInfo wrappedKeyInfo)
      • getXMLSignatureElements

        protected java.util.List<XMLSignatureElement> getXMLSignatureElements()
      • getSignatureId

        protected java.lang.String getSignatureId​(java.lang.String idPrefix)
      • getSignatureValueId

        protected java.lang.String getSignatureValueId​(java.lang.String idPrefix)
      • getKeyInfoId

        protected java.lang.String getKeyInfoId​(java.lang.String idPrefix)
      • getXMLSignatureFactory

        protected javax.xml.crypto.dsig.XMLSignatureFactory getXMLSignatureFactory()
      • getReference

        protected javax.xml.crypto.dsig.Reference getReference​(java.lang.String uri)
                                                        throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getReference

        protected javax.xml.crypto.dsig.Reference getReference​(java.lang.String uri,
                                                               java.lang.String type)
                                                        throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getReference

        protected javax.xml.crypto.dsig.Reference getReference​(java.lang.String uri,
                                                               java.util.List<javax.xml.crypto.dsig.Transform> transforms,
                                                               java.lang.String type)
                                                        throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getReference

        protected javax.xml.crypto.dsig.Reference getReference​(java.lang.String uri,
                                                               java.util.List<javax.xml.crypto.dsig.Transform> transforms,
                                                               java.lang.String type,
                                                               java.lang.String referenceId)
                                                        throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getReferences

        protected java.util.List<javax.xml.crypto.dsig.Reference> getReferences​(java.util.List<?> idList)
                                                                         throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getDigestMethod

        protected javax.xml.crypto.dsig.DigestMethod getDigestMethod()
                                                              throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • setDigestMethod

        public void setDigestMethod​(java.lang.String method)
                             throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • newKeyInfo

        protected javax.xml.crypto.dsig.keyinfo.KeyInfo newKeyInfo​(java.security.cert.X509Certificate certificate,
                                                                   java.lang.String keyInfoId)
                                                            throws java.security.KeyException
        Throws:
        java.security.KeyException
      • newXMLObject

        protected javax.xml.crypto.dsig.XMLObject newXMLObject​(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
      • newXMLObject

        protected javax.xml.crypto.dsig.XMLObject newXMLObject​(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects,
                                                               java.lang.String id)
      • newXMLObject

        protected javax.xml.crypto.dsig.XMLObject newXMLObject​(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects,
                                                               java.lang.String id,
                                                               java.lang.String mimeType)
      • newXMLObject

        protected javax.xml.crypto.dsig.XMLObject newXMLObject​(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects,
                                                               java.lang.String id,
                                                               java.lang.String mimeType,
                                                               java.lang.String encoding)
      • getDefaultXMLObjectId

        protected java.lang.String getDefaultXMLObjectId()
      • getDefaultXMLObjectMimeType

        protected java.lang.String getDefaultXMLObjectMimeType()
      • getDefaultXMLObjectEncoding

        protected java.lang.String getDefaultXMLObjectEncoding()
      • addXMLObject

        public javax.xml.crypto.dsig.XMLObject addXMLObject​(javax.xml.crypto.dsig.XMLObject xmlObject)
      • marshalQualifyingProperties

        protected QualifyingProperties marshalQualifyingProperties​(java.lang.String xmlNamespace,
                                                                   java.lang.String signedPropertiesTypeUrl,
                                                                   java.lang.String signatureIdPrefix,
                                                                   java.util.List referencesIdList)
                                                            throws java.security.GeneralSecurityException,
                                                                   javax.xml.crypto.MarshalException
        Throws:
        java.security.GeneralSecurityException
        javax.xml.crypto.MarshalException
      • marshalQualifyingProperties

        protected QualifyingProperties marshalQualifyingProperties​(java.lang.String xmlNamespace,
                                                                   java.lang.String signedPropertiesTypeUrl,
                                                                   java.lang.String signatureIdPrefix,
                                                                   java.util.List referencesIdList,
                                                                   java.util.List<javax.xml.crypto.dsig.Transform> transforms)
                                                            throws java.security.GeneralSecurityException,
                                                                   javax.xml.crypto.MarshalException
        Throws:
        java.security.GeneralSecurityException
        javax.xml.crypto.MarshalException
      • marshalXMLSignature

        protected javax.xml.crypto.dsig.XMLObject marshalXMLSignature​(java.lang.String xadesNamespace,
                                                                      java.lang.String signedPropertiesTypeUrl,
                                                                      java.lang.String signatureIdPrefix,
                                                                      java.util.List referencesIdList)
                                                               throws java.security.GeneralSecurityException,
                                                                      javax.xml.crypto.MarshalException
        Throws:
        java.security.GeneralSecurityException
        javax.xml.crypto.MarshalException
      • marshalXMLSignature

        protected javax.xml.crypto.dsig.XMLObject marshalXMLSignature​(java.lang.String xadesNamespace,
                                                                      java.lang.String signedPropertiesTypeUrl,
                                                                      java.lang.String signatureIdPrefix,
                                                                      java.util.List referencesIdList,
                                                                      java.util.List<javax.xml.crypto.dsig.Transform> SignedPropertiesTransforms)
                                                               throws java.security.GeneralSecurityException,
                                                                      javax.xml.crypto.MarshalException
        Throws:
        java.security.GeneralSecurityException
        javax.xml.crypto.MarshalException