本文整理汇总了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);
}