我想了解有关 SignerCTest 的一些信息,因为实际上我有一些问题:
在我的主要课程中:
public class XadesTest{
public static void main(String[] args) throws Exception {
SignerCTest signerCTest = new SignerCTest();
System.out.println("signerCTest : " + signerCTest.toString());
signerCTest.testSignC();
}
在我的 SignerCTest.class 中:
public class SignerCTest extends SignerTestBase
{
//@Test
public void testSignC() throws Exception
{
System.out.println("signC");
Document doc = getTestDocument();
Element elemToSign = doc.getDocumentElement();
ValidationDataProvider vdp = new ValidationDataFromCertValidationProvider(VerifierTestBase.validationProviderNist);
SignerC signer = (SignerC)new XadesCSigningProfile(keyingProviderNist, vdp).newSigner();
new Enveloped(signer).sign(elemToSign);
outputDocument(doc, "document.signed.c.xml");
}
}
我有这些错误:
signerCTest : xadestest.SignerCTest@345b43
signC
Exception in thread "main" xades4j.providers.ValidationDataException: Cannot validate certificate: unable to find valid certification path to requested target
at xades4j.providers.impl.ValidationDataFromCertValidationProvider.getValidationData(ValidationDataFromCertValidationProvider.java:54)
at xades4j.production.SignerC.getFormatSpecificSignatureProperties(SignerC.java:70)
at xades4j.production.SignerBES.sign(SignerBES.java:200)
at xades4j.production.Enveloped.sign(Enveloped.java:69)
at xadestest.SignerCTest.testSignC(SignerCTest.java:45)
at xadestest.XadesTest.main(XadesTest.java:84)
Caused by: xades4j.providers.CannotBuildCertificationPathException: unable to find valid certification path to requested target
at xades4j.providers.impl.PKIXCertificateValidationProvider.validate(PKIXCertificateValidationProvider.java:142)
at xades4j.providers.impl.ValidationDataFromCertValidationProvider.getValidationData(ValidationDataFromCertValidationProvider.java:51)
... 5 more
Java Result: 1
BUILD SUCCESSFUL (total time: 17 seconds)
但是证书在这里很好:
D:\NetBeansProjects_MYSIGN\XadesTest\src\test\cert\my\LG.pfx
D:\NetBeansProjects_MYSIGN\XadesTest\src\test\cert\csrc.nist\test4.p12
所以……我不明白。有谁能够帮我 ?
谢谢,威廉。