我来用 XAdES4j 签署一个 XML 文件,但是在验证它时,我总是得到“未指定签名节点”。显然signatureParent
是null
!如何解决?
这是我的代码:
FileSystemDirectoryCertStore certStore = new FileSystemDirectoryCertStore(".");
KeyStore trustAnchors = createAndLoadJKSKeyStore(".\\myStore", "mystorepass");
CertificateValidationProvider certValidator = new PKIXCertificateValidationProvider(trustAnchors, false, certStore.getStore());
XadesVerificationProfile p = new XadesVerificationProfile(certValidator);
XadesVerifier v = p.newVerifier();
Document sourceDoc = Signapp.getDocument(".\\TEST.XML.FILE.xml");
Element signatureParent = (Element)sourceDoc.getElementsByTagNameNS(Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);;
XAdESVerificationResult r = v.verify(signatureParent,null);