在这一刻,我在签名 EPES 上工作,我想要一些信息;
要签名,我在SignerTestBase.java:
public class SignerTestBase extends SignatureServicesTestBase
{
static protected KeyingDataProvider keyingProviderMy;
static protected KeyingDataProvider keyingProviderNist;
static
{
try
{
keyingProviderMy = createFileSystemKeyingDataProvider("pkcs12", "my/LG.pfx", "mykeypass", true);
keyingProviderNist = createFileSystemKeyingDataProvider("pkcs12", "csrc.nist/test4.p12", "password", false);
} catch (KeyStoreException e)
{
throw new NullPointerException("SignerTestBase init failed: " + e.getMessage());
}
}
public static Document getTestDocument() throws Exception
{
//return getDocument("document.xml");
//==that I changed=====================================================================
**return getDocument("b.xml");**
}
和 :
@Test
public void testSignEPES() throws Exception
{
System.out.println("signEPES");
Document doc = getTestDocument();
Element elemToSign = doc.getDocumentElement();
SignerEPES signer = (SignerEPES)new XadesEpesSigningProfile(keyingProviderMy, policyInfoProvider).newSigner();
new Enveloped(signer).sign(elemToSign);
**outputDocument(doc, "document.signed.epes.xml");**
}
在主要:
System.out.println("============================================================================");
System.out.println("XADESTEST : EPES SIGNATURE");
System.out.println("============================================================================");
System.out.println();
SignerEPESTest signerEPESTest = new SignerEPESTest();
System.out.println("signerEPESTest : " + signerEPESTest.toString());
/**
* ==== NOT OK =====
*/
**signerEPESTest.testSignEPES();**
当我运行时在我的控制台中:
============================================================================
XADESTEST : EPES SIGNATURE
============================================================================
signerEPESTest : xadestest.SignerEPESTest@1c63e8c
signEPES
Exception in thread "main" java.lang.NullPointerException
at xades4j.utils.XadesProfileCore.addBinding(XadesProfileCore.java:81)
at xades4j.production.XadesSigningProfile.withBinding(XadesSigningProfile.java:131)
at xades4j.production.XadesEpesSigningProfile.<init>(XadesEpesSigningProfile.java:51)
at xadestest.SignerEPESTest.testSignEPES(SignerEPESTest.java:59)
at xadestest.XadesTest.main(XadesTest.java:103)
Java Result: 1
BUILD SUCCESSFUL (total time: 16 seconds)
请在我搜索期间,有人可以帮助我吗?
将要