Class XMLAdvancedSignature
- java.lang.Object
-
- es.uji.crypto.xades.jxades.security.xml.XAdES.XMLAdvancedSignature
-
public class XMLAdvancedSignature extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.w3c.dom.Element
baseElement
protected java.lang.String
defaultXMLObjectEncoding
protected java.lang.String
defaultXMLObjectId
protected java.util.List<javax.xml.crypto.XMLStructure>
defaultXMLObjectItems
protected java.lang.String
defaultXMLObjectMimeType
protected javax.xml.crypto.dsig.DigestMethod
digestMethod
static java.lang.String
ELEMENT_SIGNATURE
static java.lang.String
ELEMENT_SIGNATURE_VALUE
private java.util.List<QualifyingPropertiesReference>
qualifyingPropertiesReferences
protected javax.xml.crypto.dsig.XMLSignature
signature
protected javax.xml.crypto.dsig.dom.DOMSignContext
signContext
java.lang.String
signedPropertiesTypeUrl
protected XmlWrappedKeyInfo
wrappedKeyInfo
protected BaseXAdESImpl
xades
static java.lang.String
XADES_v132
static java.lang.String
XADES_v141
protected java.lang.String
xadesNamespace
protected java.util.List<javax.xml.crypto.dsig.XMLObject>
xmlObjects
protected javax.xml.crypto.dsig.XMLSignatureFactory
xmlSignatureFactory
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLAdvancedSignature(XAdESBase xades)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.crypto.dsig.XMLObject
addXMLObject(javax.xml.crypto.dsig.XMLObject xmlObject)
org.w3c.dom.Document
getBaseDocument()
org.w3c.dom.Element
getBaseElement()
protected java.lang.String
getDefaultXMLObjectEncoding()
protected java.lang.String
getDefaultXMLObjectId()
protected java.lang.String
getDefaultXMLObjectMimeType()
protected javax.xml.crypto.dsig.DigestMethod
getDigestMethod()
static XMLAdvancedSignature
getInstance(XAdESBase xades)
protected java.lang.String
getKeyInfoId(java.lang.String idPrefix)
java.util.List<QualifyingPropertiesReference>
getQualifyingPropertiesReferences()
protected javax.xml.crypto.dsig.Reference
getReference(java.lang.String uri)
protected javax.xml.crypto.dsig.Reference
getReference(java.lang.String uri, java.lang.String type)
protected javax.xml.crypto.dsig.Reference
getReference(java.lang.String uri, java.util.List<javax.xml.crypto.dsig.Transform> transforms, java.lang.String type)
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)
protected java.util.List<javax.xml.crypto.dsig.Reference>
getReferences(java.util.List<?> idList)
protected java.lang.String
getSignatureId(java.lang.String idPrefix)
protected java.lang.String
getSignatureValueId(java.lang.String idPrefix)
WrappedKeyStorePlace
getWrappedKeyStorePlace()
java.util.List<javax.xml.crypto.dsig.XMLObject>
getXMLObjects()
protected java.util.List<XMLSignatureElement>
getXMLSignatureElements()
protected javax.xml.crypto.dsig.XMLSignatureFactory
getXMLSignatureFactory()
XmlWrappedKeyInfo
getXmlWrappedKeyInfo()
protected QualifyingProperties
marshalQualifyingProperties(java.lang.String xmlNamespace, java.lang.String signedPropertiesTypeUrl, java.lang.String signatureIdPrefix, java.util.List referencesIdList)
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)
protected javax.xml.crypto.dsig.XMLObject
marshalXMLSignature(java.lang.String xadesNamespace, java.lang.String signedPropertiesTypeUrl, java.lang.String signatureIdPrefix, java.util.List referencesIdList)
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)
static XMLAdvancedSignature
newInstance(XAdESBase xades)
protected javax.xml.crypto.dsig.keyinfo.KeyInfo
newKeyInfo(java.security.cert.X509Certificate certificate, java.lang.String keyInfoId)
protected javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
protected javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id)
protected javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id, java.lang.String mimeType)
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)
void
setDigestMethod(java.lang.String method)
void
setQualifyingPropertiesReferences(java.util.List<QualifyingPropertiesReference> refs)
void
setSignedPropertiesTypeUrl(java.lang.String signedPropertiesTypeUrl)
void
setWrappedKeyStorePlace(WrappedKeyStorePlace wrappedKeyStorePlace)
void
setXadesNamespace(java.lang.String xadesNamespace)
void
setXmlWrappedKeyInfo(XmlWrappedKeyInfo wrappedKeyInfo)
void
sign(java.security.cert.X509Certificate signingCert, java.security.PrivateKey privateKey, java.lang.String signatureMethod, java.util.List refsIdList, java.lang.String signatureIdPrefix)
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)
java.util.List<SignatureStatus>
validate()
-
-
-
Field Detail
-
XADES_v132
public static final java.lang.String XADES_v132
- See Also:
- Constant Field Values
-
XADES_v141
public static final java.lang.String XADES_v141
- See Also:
- Constant Field Values
-
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
-
xades
protected BaseXAdESImpl xades
-
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
-
wrappedKeyInfo
protected XmlWrappedKeyInfo wrappedKeyInfo
-
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
-
qualifyingPropertiesReferences
private java.util.List<QualifyingPropertiesReference> qualifyingPropertiesReferences
-
-
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
-
validate
public java.util.List<SignatureStatus> validate()
-
getWrappedKeyStorePlace
public WrappedKeyStorePlace getWrappedKeyStorePlace()
-
setWrappedKeyStorePlace
public void setWrappedKeyStorePlace(WrappedKeyStorePlace wrappedKeyStorePlace)
-
getXmlWrappedKeyInfo
public XmlWrappedKeyInfo getXmlWrappedKeyInfo()
-
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
-
getQualifyingPropertiesReferences
public java.util.List<QualifyingPropertiesReference> getQualifyingPropertiesReferences()
-
setQualifyingPropertiesReferences
public void setQualifyingPropertiesReferences(java.util.List<QualifyingPropertiesReference> refs)
-
-