Class XMLSignatureDocument
- java.lang.Object
-
- es.uji.crypto.xades.jxades.security.xml.XMLSignatureDocument
-
public class XMLSignatureDocument extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private org.w3c.dom.Element
baseElement
private java.util.List<javax.xml.crypto.dsig.SignatureProperty>
defaultSignatureProperties
private java.lang.String
defaultSignaturePropertiesId
private java.lang.String
defaultXMLObjectEncoding
private java.lang.String
defaultXMLObjectId
private java.util.List<javax.xml.crypto.XMLStructure>
defaultXMLObjectItems
private java.lang.String
defaultXMLObjectMimeType
private javax.xml.crypto.dsig.DigestMethod
digestMethod
private java.util.List<javax.xml.crypto.dsig.SignatureProperties>
listOfSignatureProperties
private XmlWrappedKeyInfo
wrappedKeyInfo
private java.util.List<javax.xml.crypto.dsig.XMLObject>
xmlObjects
private javax.xml.crypto.dsig.XMLSignatureFactory
xmlSignatureFactory
-
Constructor Summary
Constructors Constructor Description XMLSignatureDocument(org.w3c.dom.Element baseElement)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSignatureProperty(java.util.List<javax.xml.crypto.dom.DOMStructure> content, java.lang.String target, java.lang.String id)
void
addSignatureProperty(javax.xml.crypto.dsig.SignatureProperty signatureProperty)
javax.xml.crypto.dsig.XMLObject
addXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
javax.xml.crypto.dsig.XMLObject
addXMLObject(javax.xml.crypto.dsig.XMLObject xmlObject)
void
addXMLObjectItem(javax.xml.crypto.XMLStructure xmlObjectItem)
org.w3c.dom.Element
getBaseElement()
javax.xml.crypto.dsig.SignatureProperties
getDefaultSignatureProperties()
java.lang.String
getDefaultSignaturePropertiesId()
javax.xml.crypto.dsig.XMLObject
getDefaultXMLObject()
java.lang.String
getDefaultXMLObjectEncoding()
java.lang.String
getDefaultXMLObjectId()
java.lang.String
getDefaultXMLObjectMimeType()
javax.xml.crypto.dsig.DigestMethod
getDigestMethod()
protected java.lang.String
getKeyInfoId(java.lang.String idPrefix)
java.util.List<javax.xml.crypto.dsig.SignatureProperties>
getListOfSignatureProperties()
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 transforms, java.lang.String type)
protected javax.xml.crypto.dsig.Reference
getReference(java.lang.String uri, java.util.List 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.XMLStructure>
getXMLObjectItems()
java.util.List<javax.xml.crypto.dsig.XMLObject>
getXMLObjects()
java.util.List<XMLSignatureElement>
getXMLSignatureElements()
protected javax.xml.crypto.dsig.XMLSignatureFactory
getXMLSignatureFactory()
XmlWrappedKeyInfo
getXmlWrappedKeyInfo()
private static org.w3c.dom.Document
loadEncryptionDocument()
javax.xml.crypto.dsig.keyinfo.KeyInfo
newKeyInfo(java.security.cert.X509Certificate certificate, java.lang.String keyInfoId)
javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id)
javax.xml.crypto.dsig.XMLObject
newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id, java.lang.String mimeType)
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)
static void
printDocument(org.w3c.dom.Node node)
void
setDefaultSignaturePropertiesId(java.lang.String id)
void
setDefaultXMLObjectEncoding(java.lang.String defaultXMLObjectEncoding)
void
setDefaultXMLObjectId(java.lang.String defaultXMLObjectId)
void
setDefaultXMLObjectMimeType(java.lang.String defaultXMLObjectMimeType)
void
setDigestMethod(javax.xml.crypto.dsig.DigestMethod digestMethod)
void
setListOfSignatureProperties(java.util.List<javax.xml.crypto.dsig.SignatureProperties> listOfSignatureProperties)
void
setWrappedKeyStorePlace(WrappedKeyStorePlace wrappedKeyStorePlace)
void
setXmlWrappedKeyInfo(XmlWrappedKeyInfo wrappedKeyInfo)
void
sign(java.security.cert.X509Certificate certificate, java.security.PrivateKey privateKey, java.lang.String signatureMethod, java.util.List referencesIdList, java.lang.String signatureIdPrefix, java.lang.String xadesPrefix, java.lang.String xadesNamespace, java.lang.String xmlSignaturePrefix)
java.util.List<SignatureStatus>
validate()
-
-
-
Field Detail
-
baseElement
private org.w3c.dom.Element baseElement
-
xmlSignatureFactory
private javax.xml.crypto.dsig.XMLSignatureFactory xmlSignatureFactory
-
digestMethod
private javax.xml.crypto.dsig.DigestMethod digestMethod
-
wrappedKeyInfo
private XmlWrappedKeyInfo wrappedKeyInfo
-
listOfSignatureProperties
private java.util.List<javax.xml.crypto.dsig.SignatureProperties> listOfSignatureProperties
-
defaultSignatureProperties
private java.util.List<javax.xml.crypto.dsig.SignatureProperty> defaultSignatureProperties
-
defaultSignaturePropertiesId
private java.lang.String defaultSignaturePropertiesId
-
xmlObjects
private java.util.List<javax.xml.crypto.dsig.XMLObject> xmlObjects
-
defaultXMLObjectItems
private java.util.List<javax.xml.crypto.XMLStructure> defaultXMLObjectItems
-
defaultXMLObjectId
private java.lang.String defaultXMLObjectId
-
defaultXMLObjectMimeType
private java.lang.String defaultXMLObjectMimeType
-
defaultXMLObjectEncoding
private java.lang.String defaultXMLObjectEncoding
-
-
Method Detail
-
getBaseElement
public org.w3c.dom.Element getBaseElement()
-
getXMLSignatureFactory
protected javax.xml.crypto.dsig.XMLSignatureFactory getXMLSignatureFactory()
-
getDigestMethod
public javax.xml.crypto.dsig.DigestMethod getDigestMethod() throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
setDigestMethod
public void setDigestMethod(javax.xml.crypto.dsig.DigestMethod digestMethod)
-
getXMLSignatureElements
public java.util.List<XMLSignatureElement> getXMLSignatureElements()
-
getXmlWrappedKeyInfo
public XmlWrappedKeyInfo getXmlWrappedKeyInfo()
-
setXmlWrappedKeyInfo
public void setXmlWrappedKeyInfo(XmlWrappedKeyInfo wrappedKeyInfo)
-
getWrappedKeyStorePlace
public WrappedKeyStorePlace getWrappedKeyStorePlace()
-
setWrappedKeyStorePlace
public void setWrappedKeyStorePlace(WrappedKeyStorePlace wrappedKeyStorePlace)
-
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 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 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
-
validate
public java.util.List<SignatureStatus> validate()
-
sign
public void sign(java.security.cert.X509Certificate certificate, java.security.PrivateKey privateKey, java.lang.String signatureMethod, java.util.List referencesIdList, java.lang.String signatureIdPrefix, java.lang.String xadesPrefix, java.lang.String xadesNamespace, java.lang.String xmlSignaturePrefix) throws javax.xml.crypto.MarshalException, javax.xml.crypto.dsig.XMLSignatureException, java.security.GeneralSecurityException
- Throws:
javax.xml.crypto.MarshalException
javax.xml.crypto.dsig.XMLSignatureException
java.security.GeneralSecurityException
-
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)
-
newKeyInfo
public javax.xml.crypto.dsig.keyinfo.KeyInfo newKeyInfo(java.security.cert.X509Certificate certificate, java.lang.String keyInfoId) throws java.security.KeyException
- Throws:
java.security.KeyException
-
getListOfSignatureProperties
public java.util.List<javax.xml.crypto.dsig.SignatureProperties> getListOfSignatureProperties()
-
setListOfSignatureProperties
public void setListOfSignatureProperties(java.util.List<javax.xml.crypto.dsig.SignatureProperties> listOfSignatureProperties)
-
addSignatureProperty
public void addSignatureProperty(javax.xml.crypto.dsig.SignatureProperty signatureProperty)
-
addSignatureProperty
public void addSignatureProperty(java.util.List<javax.xml.crypto.dom.DOMStructure> content, java.lang.String target, java.lang.String id)
-
getDefaultSignatureProperties
public javax.xml.crypto.dsig.SignatureProperties getDefaultSignatureProperties()
-
setDefaultSignaturePropertiesId
public void setDefaultSignaturePropertiesId(java.lang.String id)
-
getDefaultSignaturePropertiesId
public java.lang.String getDefaultSignaturePropertiesId()
-
newXMLObject
public javax.xml.crypto.dsig.XMLObject newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
-
newXMLObject
public javax.xml.crypto.dsig.XMLObject newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id)
-
newXMLObject
public javax.xml.crypto.dsig.XMLObject newXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id, java.lang.String mimeType)
-
newXMLObject
public 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)
-
addXMLObject
public javax.xml.crypto.dsig.XMLObject addXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)
-
addXMLObject
public javax.xml.crypto.dsig.XMLObject addXMLObject(javax.xml.crypto.dsig.XMLObject xmlObject)
-
getXMLObjects
public java.util.List<javax.xml.crypto.dsig.XMLObject> getXMLObjects()
-
addXMLObjectItem
public void addXMLObjectItem(javax.xml.crypto.XMLStructure xmlObjectItem)
-
getDefaultXMLObject
public javax.xml.crypto.dsig.XMLObject getDefaultXMLObject()
-
getXMLObjectItems
public java.util.List<javax.xml.crypto.XMLStructure> getXMLObjectItems()
-
setDefaultXMLObjectId
public void setDefaultXMLObjectId(java.lang.String defaultXMLObjectId)
-
getDefaultXMLObjectId
public java.lang.String getDefaultXMLObjectId()
-
setDefaultXMLObjectMimeType
public void setDefaultXMLObjectMimeType(java.lang.String defaultXMLObjectMimeType)
-
getDefaultXMLObjectMimeType
public java.lang.String getDefaultXMLObjectMimeType()
-
setDefaultXMLObjectEncoding
public void setDefaultXMLObjectEncoding(java.lang.String defaultXMLObjectEncoding)
-
getDefaultXMLObjectEncoding
public java.lang.String getDefaultXMLObjectEncoding()
-
loadEncryptionDocument
private static org.w3c.dom.Document loadEncryptionDocument() throws java.lang.Exception
- Throws:
java.lang.Exception
-
printDocument
public static void printDocument(org.w3c.dom.Node node) throws javax.xml.transform.TransformerException
- Throws:
javax.xml.transform.TransformerException
-
-