私は「SignerTestBase」でSignerTTest.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("fv.xml");
}
私はクラスSignerTTest.javaを持っています
@Test
public void testSignTPtCC() throws Exception
{
System.out.println("signTPtCitizenCard");
if (!onWindowsPlatform())
fail("Test written for the Windows platform");
Document doc = getTestDocument();
Element elemToSign = doc.getDocumentElement();
try
{
PKCS11KeyStoreKeyingDataProvider ptccKeyingDataProv = new PKCS11KeyStoreKeyingDataProvider(
//"C:\\Windows\\System32\\pteidpkcs11.dll", "PT_CC",
"C:\\Windows\\system32\\pteidpkcs11.dll", "PT_CC",
new FirstCertificateSelector(), null, null, false);
SignerT signer = (SignerT)new XadesTSigningProfile(ptccKeyingDataProv).withAlgorithmsProvider(PtCcAlgorithmsProvider.class).newSigner();
new xades4j.production.Enveloped(signer).sign(elemToSign);
outputDocument(doc, "document.signed.t.bes.ptcc.xml");
} catch (ProviderException ex)
{
fail(" !!!!!!!PT CC PKCS#11 provider not configured !!!!!!!!!!!!");
}
}
そして私のmain.classで:
System.out.println("============================================================================");
System.out.println("XADESTEST : T SIGNATURE");
System.out.println("============================================================================");
System.out.println();
SignerTTest signerTTest = new SignerTTest();
System.out.println("signerTTest : " + signerTTest.toString());
/**
* ==== NOT OK =====
*/
signerTTest.testSignTPtCC();
そして私のコンソールで私は得る:
> ============================================================================
XADESTEST : T SIGNATURE
============================================================================
signerTTest : xadestest.SignerTTest@1304043
signTPtCitizenCard
Exception in thread "main" java.lang.AssertionError: !!!!!!!PT CC PKCS#11 provider not configured !!!!!!!!!!!!
at org.junit.Assert.fail(Assert.java:58)
at xadestest.SignerTTest.testSignTPtCC(SignerTTest.java:119)
at xadestest.XadesTest.main(XadesTest.java:117)
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
検索中に問題についてアドバイスをいただけますか?
ありがとう、
意思。