本文整理匯總了Java中eu.europa.esig.dss.client.http.commons.FileCacheDataLoader類的典型用法代碼示例。如果您正苦於以下問題:Java FileCacheDataLoader類的具體用法?Java FileCacheDataLoader怎麽用?Java FileCacheDataLoader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FileCacheDataLoader類屬於eu.europa.esig.dss.client.http.commons包,在下文中一共展示了FileCacheDataLoader類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFileCacheDataLoader
import eu.europa.esig.dss.client.http.commons.FileCacheDataLoader; //導入依賴的package包/類
private DataLoader getFileCacheDataLoader() {
FileCacheDataLoader cacheDataLoader = new FileCacheDataLoader();
CommonsDataLoader dataLoader = new CommonsDataLoader();
dataLoader.setProxyConfig(getProxyConfig());
cacheDataLoader.setDataLoader(dataLoader);
cacheDataLoader.setFileCacheDirectory(new File("target"));
cacheDataLoader.setCacheExpirationTime(3600000L);
return cacheDataLoader;
}
示例2: validateXAdESBaselineLTWithOnlineSources
import eu.europa.esig.dss.client.http.commons.FileCacheDataLoader; //導入依賴的package包/類
@Test
public void validateXAdESBaselineLTWithOnlineSources() throws IOException {
// tag::demo[]
// To be able to validate our fake signature, we must define one of the certificates in the chain as trusted
// anchor.
// If you have a real signature for which it is possible to build the chain till the TSL then just skip this
// point.
preparePKCS12TokenAndKey();
final CertificateToken[] certificateChain = privateKey.getCertificateChain();
final CertificateToken trustedCertificate = certificateChain[0];
// Already signed document
DSSDocument document = new FileDocument(new File("src/test/resources/signedXmlXadesLT.xml"));
SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(document);
CommonsDataLoader commonsDataLoader = new CommonsDataLoader();
CommonCertificateVerifier verifier = new CommonCertificateVerifier();
OnlineCRLSource crlSource = new OnlineCRLSource();
crlSource.setDataLoader(commonsDataLoader);
verifier.setCrlSource(crlSource);
OnlineOCSPSource ocspSource = new OnlineOCSPSource();
// The default OCSPDataLoader is created. You can also create your own HttpDataLoader.
verifier.setOcspSource(ocspSource);
// SEE NOTE 1
FileCacheDataLoader fileCacheDataLoader = new FileCacheDataLoader();
File cacheFolder = new File("/temp");
fileCacheDataLoader.setFileCacheDirectory(cacheFolder);
KeyStoreCertificateSource keyStoreCertificateSource = new KeyStoreCertificateSource(new File("src/main/resources/keystore.p12"), "PKCS12",
"dss-password");
TrustedListsCertificateSource certificateSource = new TrustedListsCertificateSource();
TSLRepository tslRepository = new TSLRepository();
tslRepository.setTrustedListsCertificateSource(certificateSource);
TSLValidationJob job = new TSLValidationJob();
job.setDataLoader(new CommonsDataLoader());
job.setOjContentKeyStore(keyStoreCertificateSource);
job.setLotlRootSchemeInfoUri("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl.html");
job.setLotlUrl("https://ec.europa.eu/information_society/policy/esignature/trusted-list/tl-mp.xml");
job.setOjUrl("http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=uriserv:OJ.C_.2016.233.01.0001.01.ENG");
job.setLotlCode("EU");
job.setRepository(tslRepository);
job.refresh();
certificateSource.addCertificate(trustedCertificate, new MockServiceInfo());
verifier.setTrustedCertSource(certificateSource);
verifier.setDataLoader(fileCacheDataLoader);
validator.setCertificateVerifier(verifier);
Reports reports = validator.validateDocument();
SimpleReport simpleReport = reports.getSimpleReport();
DetailedReport detailedReport = reports.getDetailedReport();
// end::demo[]
assertNotNull(reports);
assertNotNull(simpleReport);
assertNotNull(detailedReport);
}