xades4j

Xades4j and Base64 in EnvelopedXmlObject

帅比萌擦擦* 提交于 2021-02-11 12:28:46
问题 I tried to insert Base64 string into Object in EnvelopedXmlObject: DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document document = dBuilder.newDocument(); String generatedDocument = ...; BASE64Encoder encoder = new BASE64Encoder(); String generatedDocumentEncoded = encoder.encode(generatedDocument .getBytes("UTF-8")); Node node1 = document.createTextNode

Digest value mismatch

只愿长相守 提交于 2020-01-25 21:41:06
问题 I'm using xades4j to crate a XAdES-T enveloped signature for an XML file. When I'm verifying the signed XML I get an error saying "Digest value computed does not match the digest value within the ds:Reference" where the reference points to the element of Type="http://uri.etsi.org/01903#SignedProperties". The digest value of the root XML element itself is OK. Has anybody faced with such a problem? The only thing I could detect is that the signing time is not in the Zulu format but looks like

Signing document with qualified certificate - smart card

白昼怎懂夜的黑 提交于 2019-12-25 08:04:09
问题 Code below works correctly for 2 different cryptografic smart-card libraries (certum cryptoCertum3PKCS.dll and cencert enigmap11.dll ), but it's crashing for kir(szafir) lib - ccpkip11.dll, after providing pin, which is for 100% correct Anyone has an idea what I'm doing wrong? KeyingDataProvider kp = new PKCS11KeyStoreKeyingDataProvider( settings.getDriverPath(), settings.getProviderName(), settings.getSlot(), new CertificateSelector(), new KeyStorePasswordProvider(), null, false); Document

Xades4j verification - Cannot create a null:null from a http://www.w3.org/2000/09/xmldsig#

夙愿已清 提交于 2019-12-25 04:19:38
问题 Im trying to write program which should verify XML sign using xades4j library. I have something like this: public static void verify() throws Exception { FileSystemDirectoryCertStore certStore = new FileSystemDirectoryCertStore("C:\\(...)"); KeyStore trustAnchors = KeyStore.getInstance("jks"); trustAnchors.load(null); CertificateValidationProvider certValidator = new PKIXCertificateValidationProvider(trustAnchors, false, certStore.getStore()); XadesVerificationProfile p = new

namespace and xpath

落爺英雄遲暮 提交于 2019-12-24 20:25:12
问题 Libarary xades4j . code as following: static { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException ex) { // ... ... } } Document doc = db.getNewDocument(); DataObjectDesc obj1 = new DataObjectReference( "file:///E:/doctosign/forxpath/ori_message.xml") .withCommitmentType(getCommitmentType()) .withTransform(new CanonicalXMLWithoutComments()) .withTransform(XPath2Filter

XADES4J - How to change <ds:Object Id=“xmldsig-1ddcf1ab-7648-4039-b166-69e14da39982-object0”…> to something other id

送分小仙女□ 提交于 2019-12-24 10:37:57
问题 When i signing XML document with Xades4J (Xades-BES), i'm getting signed document including my xml within something like: <ds:Object Encoding="UTF-8" Id="xmldsig-1ddcf1ab-7648-4039-b166-69e14da39982-object0" MimeType="text/xml"> .... </ds:Object> i must change Id="xmldsig-1ddcf1ab-7648-4039-b166-69e14da39982-object0" to Id="Dokument-0" How can i do that ? Thanks for all answers and sorry for my bad english. Darek 回答1: Currently there's no way to change how the signed data object id's are

Incorrect reference in signature

大城市里の小女人 提交于 2019-12-12 13:58:33
问题 I have another problem with Counter Signature. This time I forced it to work... almost. Bellow is the copy of the Signature: <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="xmldsig-33fefaee-5877-4bcb-8ee2-782d23424a86"> <ds:SignedInfo> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> <ds:Reference Id="xmldsig-33fefaee-5877-4bcb-8ee2-782d23424a86-ref0" URI

Xades4j : SignedProperties reference not found

梦想的初衷 提交于 2019-12-12 01:14:32
问题 I'm trying to validate Xades signatures using Xades4j. Some of those signatures are generated by another tool (which is not Xades4j) and those signatures have no Type attribute in the Reference tag : <ds:Reference URI="#signedProps"> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> <ds:DigestValue>KUAGWItLLNF6sNZ3kXy+/6oJyEo=</ds:DigestValue> </ds:Reference> i've got this Exception when i try to validate it : xades4j.verification

Xml signing with remote applet devices

偶尔善良 提交于 2019-12-11 19:03:13
问题 All files are stored in the cloud system. The average size of file 200MB.Very large size of the files.Also Usb token on the client side. I don't want to transfer entire file from the server to client. I just want to sign the hash of the file on the client side. How can I do this with the xades4j library? 回答1: I'm not sure I fully understood, but here are some ideas: Make the file accessible via HTTP. Xade4j (actually, the underlying Apache Santuario) already supports HTTP data object

Xades countersign document

拟墨画扇 提交于 2019-12-11 12:36:21
问题 I have an XML document which is already Xades signed. Now I want to counter sign this signature. How can I do this with Xades4j? I have searched the documentation but there is only example how to sign and countersign together. 回答1: You can use a format extender directly to add new unsigned properties to an existing signature. 来源: https://stackoverflow.com/questions/14696429/xades-countersign-document