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.ElementbaseElementprotected java.lang.StringdefaultXMLObjectEncodingprotected java.lang.StringdefaultXMLObjectIdprotected java.util.List<javax.xml.crypto.XMLStructure>defaultXMLObjectItemsprotected java.lang.StringdefaultXMLObjectMimeTypeprotected javax.xml.crypto.dsig.DigestMethoddigestMethodstatic java.lang.StringELEMENT_SIGNATUREstatic java.lang.StringELEMENT_SIGNATURE_VALUEprivate java.util.List<QualifyingPropertiesReference>qualifyingPropertiesReferencesprotected javax.xml.crypto.dsig.XMLSignaturesignatureprotected javax.xml.crypto.dsig.dom.DOMSignContextsignContextjava.lang.StringsignedPropertiesTypeUrlprotected XmlWrappedKeyInfowrappedKeyInfoprotected BaseXAdESImplxadesstatic java.lang.StringXADES_v132static java.lang.StringXADES_v141protected java.lang.StringxadesNamespaceprotected java.util.List<javax.xml.crypto.dsig.XMLObject>xmlObjectsprotected javax.xml.crypto.dsig.XMLSignatureFactoryxmlSignatureFactory
-
Constructor Summary
Constructors Modifier Constructor Description protectedXMLAdvancedSignature(XAdESBase xades)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.crypto.dsig.XMLObjectaddXMLObject(javax.xml.crypto.dsig.XMLObject xmlObject)org.w3c.dom.DocumentgetBaseDocument()org.w3c.dom.ElementgetBaseElement()protected java.lang.StringgetDefaultXMLObjectEncoding()protected java.lang.StringgetDefaultXMLObjectId()protected java.lang.StringgetDefaultXMLObjectMimeType()protected javax.xml.crypto.dsig.DigestMethodgetDigestMethod()static XMLAdvancedSignaturegetInstance(XAdESBase xades)protected java.lang.StringgetKeyInfoId(java.lang.String idPrefix)java.util.List<QualifyingPropertiesReference>getQualifyingPropertiesReferences()protected javax.xml.crypto.dsig.ReferencegetReference(java.lang.String uri)protected javax.xml.crypto.dsig.ReferencegetReference(java.lang.String uri, java.lang.String type)protected javax.xml.crypto.dsig.ReferencegetReference(java.lang.String uri, java.util.List<javax.xml.crypto.dsig.Transform> transforms, java.lang.String type)protected javax.xml.crypto.dsig.ReferencegetReference(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.StringgetSignatureId(java.lang.String idPrefix)protected java.lang.StringgetSignatureValueId(java.lang.String idPrefix)WrappedKeyStorePlacegetWrappedKeyStorePlace()java.util.List<javax.xml.crypto.dsig.XMLObject>getXMLObjects()protected java.util.List<XMLSignatureElement>getXMLSignatureElements()protected javax.xml.crypto.dsig.XMLSignatureFactorygetXMLSignatureFactory()XmlWrappedKeyInfogetXmlWrappedKeyInfo()protected QualifyingPropertiesmarshalQualifyingProperties(java.lang.String xmlNamespace, java.lang.String signedPropertiesTypeUrl, java.lang.String signatureIdPrefix, java.util.List referencesIdList)protected QualifyingPropertiesmarshalQualifyingProperties(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.XMLObjectmarshalXMLSignature(java.lang.String xadesNamespace, java.lang.String signedPropertiesTypeUrl, java.lang.String signatureIdPrefix, java.util.List referencesIdList)protected javax.xml.crypto.dsig.XMLObjectmarshalXMLSignature(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 XMLAdvancedSignaturenewInstance(XAdESBase xades)protected javax.xml.crypto.dsig.keyinfo.KeyInfonewKeyInfo(java.security.cert.X509Certificate certificate, java.lang.String keyInfoId)protected javax.xml.crypto.dsig.XMLObjectnewXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects)protected javax.xml.crypto.dsig.XMLObjectnewXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id)protected javax.xml.crypto.dsig.XMLObjectnewXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id, java.lang.String mimeType)protected javax.xml.crypto.dsig.XMLObjectnewXMLObject(java.util.List<javax.xml.crypto.XMLStructure> xmlObjects, java.lang.String id, java.lang.String mimeType, java.lang.String encoding)voidsetDigestMethod(java.lang.String method)voidsetQualifyingPropertiesReferences(java.util.List<QualifyingPropertiesReference> refs)voidsetSignedPropertiesTypeUrl(java.lang.String signedPropertiesTypeUrl)voidsetWrappedKeyStorePlace(WrappedKeyStorePlace wrappedKeyStorePlace)voidsetXadesNamespace(java.lang.String xadesNamespace)voidsetXmlWrappedKeyInfo(XmlWrappedKeyInfo wrappedKeyInfo)voidsign(java.security.cert.X509Certificate signingCert, java.security.PrivateKey privateKey, java.lang.String signatureMethod, java.util.List refsIdList, java.lang.String signatureIdPrefix)voidsign(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.MarshalExceptionjavax.xml.crypto.dsig.XMLSignatureExceptionjava.security.GeneralSecurityExceptionjavax.xml.crypto.dsig.TransformExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionorg.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.MarshalExceptionjavax.xml.crypto.dsig.XMLSignatureExceptionjava.security.GeneralSecurityExceptionjavax.xml.crypto.dsig.TransformExceptionjava.io.IOExceptionjavax.xml.parsers.ParserConfigurationExceptionorg.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.GeneralSecurityExceptionjavax.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.GeneralSecurityExceptionjavax.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.GeneralSecurityExceptionjavax.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.GeneralSecurityExceptionjavax.xml.crypto.MarshalException
-
getQualifyingPropertiesReferences
public java.util.List<QualifyingPropertiesReference> getQualifyingPropertiesReferences()
-
setQualifyingPropertiesReferences
public void setQualifyingPropertiesReferences(java.util.List<QualifyingPropertiesReference> refs)
-
-