本文整理汇总了Java中eu.europa.esig.dss.utils.Utils.fromBase64方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.fromBase64方法的具体用法?Java Utils.fromBase64怎么用?Java Utils.fromBase64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.europa.esig.dss.utils.Utils
的用法示例。
在下文中一共展示了Utils.fromBase64方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCRLRefs
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
public List<CRLRef> getCRLRefs() {
final List<CRLRef> certIds = new ArrayList<CRLRef>();
final Element signingCertEl = DomUtils.getElement(signatureElement, xPathQueryHolder.XPATH_REVOCATION_CRL_REFS);
if (signingCertEl != null) {
final NodeList crlRefNodes = DomUtils.getNodeList(signingCertEl, xPathQueryHolder.XPATH__CRL_REF);
for (int i = 0; i < crlRefNodes.getLength(); i++) {
final Element certId = (Element) crlRefNodes.item(i);
final Element digestAlgorithmEl = DomUtils.getElement(certId, xPathQueryHolder.XPATH__DAAV_DIGEST_METHOD);
final Element digestValueEl = DomUtils.getElement(certId, xPathQueryHolder.XPATH__DAAV_DIGEST_VALUE);
final String xmlName = digestAlgorithmEl.getAttribute(XMLE_ALGORITHM);
final DigestAlgorithm digestAlgo = DigestAlgorithm.forXML(xmlName);
final CRLRef ref = new CRLRef(digestAlgo, Utils.fromBase64(digestValueEl.getTextContent()));
certIds.add(ref);
}
}
return certIds;
}
示例2: getCertificates
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* @param xPathQuery
* XPath query
* @return
*/
private List<CertificateToken> getCertificates(final String xPathQuery) {
final List<CertificateToken> list = new ArrayList<CertificateToken>();
final NodeList nodeList = DomUtils.getNodeList(signatureElement, xPathQuery);
for (int ii = 0; ii < nodeList.getLength(); ii++) {
final Element certificateElement = (Element) nodeList.item(ii);
final byte[] derEncoded = Utils.fromBase64(certificateElement.getTextContent());
try {
final CertificateToken cert = DSSUtils.loadCertificate(derEncoded);
final CertificateToken certToken = addCertificate(cert);
if (!list.contains(certToken)) {
final String idIdentifier = DSSXMLUtils.getIDIdentifier(certificateElement);
certToken.setXmlId(idIdentifier);
list.add(certToken);
}
} catch (Exception e) {
LOG.warn("Unable to parse certificate '" + certificateElement.getTextContent() + "' : " + e.getMessage());
}
}
return list;
}
示例3: checkX509CertificatePresent
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* ds:KeyInfo/X509Data/X509Certificate shall be present in B/T/LT/LTA
*/
@Test
public void checkX509CertificatePresent() throws XPathExpressionException {
XPathExpression exp = xpath.compile("//ds:KeyInfo/ds:X509Data/ds:X509Certificate");
NodeList nodeList = (NodeList) exp.evaluate(document, XPathConstants.NODESET);
assertNotNull(nodeList);
int length = nodeList.getLength();
assertTrue(length > 0);
for (int i = 0; i < length; i++) {
Node node = nodeList.item(i);
String certificateBase64 = node.getTextContent();
byte[] decodeCertificate = Utils.fromBase64(certificateBase64);
CertificateToken certificateToken = DSSUtils.loadCertificate(decodeCertificate);
assertNotNull(certificateToken);
}
}
示例4: makeTimestampToken
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* This method creates {@code TimestampToken} based on provided parameters.
*
* @param timestampElement
* contains the encapsulated timestamp
* @param timestampType
* {@code TimestampType}
* @return {@code TimestampToken} of the given type
* @throws DSSException
*/
private TimestampToken makeTimestampToken(final Element timestampElement, final TimestampType timestampType) throws DSSException {
final Element timestampTokenNode = DomUtils.getElement(timestampElement, xPathQueryHolder.XPATH__ENCAPSULATED_TIMESTAMP);
if (timestampTokenNode == null) {
// TODO (09/11/2014): The error message must be propagated to the
// validation report
LOG.warn("The timestamp (" + timestampType.name() + ") cannot be extracted from the signature!");
return null;
}
TimestampToken timestampToken = null;
try {
timestampToken = new TimestampToken(Utils.fromBase64(timestampTokenNode.getTextContent()), timestampType, certPool);
} catch (Exception e) {
throw new DSSException("Unable to extract timestamp", e);
}
timestampToken.setHashCode(timestampElement.hashCode());
timestampToken.setCanonicalizationMethod(getTimestampCanonicalizationMethod(timestampElement));
// TODO: timestampToken.setIncludes(element.getIncludes)...
// final NodeList includes =
// timestampTokenNode.getElementsByTagName("Include");
// for (int i = 0; i < includes.getLength(); ++i) {
// timestampToken.getTimestampIncludes().add(new
// TimestampInclude(includes.item(i).getBaseURI(),
// includes.item(i).getAttributes()));
// }
return timestampToken;
}
示例5: getOCSPRefs
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
public List<OCSPRef> getOCSPRefs() {
final List<OCSPRef> certIds = new ArrayList<OCSPRef>();
final Element signingCertEl = DomUtils.getElement(signatureElement, xPathQueryHolder.XPATH_OCSP_REFS);
if (signingCertEl != null) {
final NodeList ocspRefNodes = DomUtils.getNodeList(signingCertEl, xPathQueryHolder.XPATH__OCSPREF);
for (int i = 0; i < ocspRefNodes.getLength(); i++) {
final Element certId = (Element) ocspRefNodes.item(i);
final Element digestAlgorithmEl = DomUtils.getElement(certId, xPathQueryHolder.XPATH__DAAV_DIGEST_METHOD);
final Element digestValueEl = DomUtils.getElement(certId, xPathQueryHolder.XPATH__DAAV_DIGEST_VALUE);
if ((digestAlgorithmEl == null) || (digestValueEl == null)) {
throw new DSSNotETSICompliantException(DSSNotETSICompliantException.MSG.XADES_DIGEST_ALG_AND_VALUE_ENCODING);
}
final String xmlName = digestAlgorithmEl.getAttribute(XMLE_ALGORITHM);
final DigestAlgorithm digestAlgo = DigestAlgorithm.forXML(xmlName);
final String digestValue = digestValueEl.getTextContent();
final byte[] base64EncodedDigestValue = Utils.fromBase64(digestValue);
final OCSPRef ocspRef = new OCSPRef(digestAlgo, base64EncodedDigestValue, false);
certIds.add(ocspRef);
}
}
return certIds;
}
示例6: generateXAdESContentTimestampAsTimestampToken
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* Method that generates a XAdES ContentTimestamp (either an ALL DATA OBJECTS TIMESTAMP or an INDIVIDUAL DATA
* OBJECTS TIMESTAMP) and returns
* it as a TimestampToken
*
* @param toSignDocument
* @param externalParameters
* @param timestampType
* @return
*/
public TimestampToken generateXAdESContentTimestampAsTimestampToken(final DSSDocument toSignDocument, final XAdESSignatureParameters externalParameters,
final TimestampType timestampType) {
if (externalParameters == null) {
throw new NullPointerException();
}
// 1. Set initial parameters
final XAdESSignatureParameters signatureParameters = setSignatureParameters(externalParameters);
// 2. Build temporary signature structure
final XAdESLevelBaselineB levelBaselineB = new XAdESLevelBaselineB(commonCertificateVerifier);
byte[] signatureValueBytes = Utils.fromBase64(fakeSignatureValue);
final DSSDocument fullSignature = levelBaselineB.signDocument(toSignDocument, signatureParameters, signatureValueBytes);
final List<Reference> references = getReferencesFromValidatedSignature(toSignDocument, fullSignature);
// 4. Concatenate byte value of references, excluding references of type SignedProperties
byte[] concatenatedReferences = concatenateReferencesAsByteArray(references);
// 5. Generate ContentTimestamp using the concatenated references
switch (timestampType) {
case ALL_DATA_OBJECTS_TIMESTAMP:
case INDIVIDUAL_DATA_OBJECTS_TIMESTAMP:
return generateTimestampToken(timestampType, externalParameters, concatenatedReferences);
default:
throw new DSSException("Incompatible timestamp type");
}
}
示例7: get
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Override
public DigestCalculator get(final AlgorithmIdentifier digestAlgorithmIdentifier) throws OperatorCreationException {
ASN1ObjectIdentifier algorithmOid = digestAlgorithmIdentifier.getAlgorithm();
final String digestBase64 = digestDocument.getDigest(DigestAlgorithm.forOID(algorithmOid.getId()));
return new DigestCalculator() {
@Override
public OutputStream getOutputStream() {
OutputStream os = new ByteArrayOutputStream();
try {
Utils.write(getDigest(), os);
} catch (IOException e) {
throw new DSSException("Unable to get outputstream", e);
}
return os;
}
@Override
public byte[] getDigest() {
return Utils.fromBase64(digestBase64);
}
@Override
public AlgorithmIdentifier getAlgorithmIdentifier() {
return digestAlgorithmIdentifier;
}
};
}
示例8: test
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
String tspB64 = "MIAGCSqGSIb3DQEHAqCAMIIUfwIBAzELMAkGBSsOAwIaBQAwgdYGCyqGSIb3DQEJEAEEoIHGBIHDMIHAAgEBBgVgOAkDATAxMA0GCWCGSAFlAwQCAQUABCBmoZEXgUpbBgPUPoUkgMuln/YWYiXK3KlI9e2GZUMSWAIHMkZGQTlGMxgPMjAxNzA4MjIwNzA5MjBaoGekZTBjMQswCQYDVQQGEwJCRTENMAsGA1UEBRMEMjAxNzEjMCEGA1UEChMaQmVsZ2l1bSBGZWRlcmFsIEdvdmVybm1lbnQxIDAeBgNVBAMTF1RpbWUgU3RhbXBpbmcgQXV0aG9yaXR5oIIRgjCCA3cwggJfoAMCAQICBAIAALkwDQYJKoZIhvcNAQEFBQAwWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVyVHJ1c3QgUm9vdDAeFw0wMDA1MTIxODQ2MDBaFw0yNTA1MTIyMzU5MDBaMFoxCzAJBgNVBAYTAklFMRIwEAYDVQQKEwlCYWx0aW1vcmUxEzARBgNVBAsTCkN5YmVyVHJ1c3QxIjAgBgNVBAMTGUJhbHRpbW9yZSBDeWJlclRydXN0IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCjBLsiq5g9V+gmcpq1edQp4uHolYCxsONbjispmmTfoV3tsAkFbdsoLs5iomL+tIjaEus46yGdwEErAVJ7iHfTHI/HurmItWoJ53PoEUCn0czKYo0t5Y8LplDSqFDDKOr1qyWHipqWHKlnuD8M1ff5UhMvwhvVcHDwj8ASygbLmuHZyjN6d9b47LnxaERCSBPSwMKkrl5g/ramBfy03QdZAtRZGJhj9aVj4JAMfV2yBnrzherr1AOuXoQ+X/8V7Wm8+Tk2cnXPd1JN88mQLLk95ckjUz8fJJghXAe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AAAAAAViqeq19MAkGBSsOAwIaBQCggaswGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJEAEEMCMGCSqGSIb3DQEJBDEWBBSGkYfvObU1iEWtmhCpWYwrcrZmCDBoBgsqhkiG9w0BCRACDDFZMFcwVTBTBBQh+hZXzxYwIa55KYlGMT1eQYZF7zA7MCykKjAoMQswCQYDVQQGEwJCRTEZMBcGA1UEAxMQQmVsZ2l1bSBSb290IENBNAILBAAAAAABWKp6rX0wDQYJKoZIhvcNAQEBBQAEggEATKFQA9ujNS0+BCiBAX0a5dg1iw3YXHs1ScwIbl7+nMytq4ewA5hc9l34KCZxybIzxCQXYj6F7hig7CDv0/2zBRrwjhJNtp9iahUVtsHFMnCeQdiq5/swCi9ldLzmiaj83s5Kg6wfEpGXPTYRPKO3joAHYH9fbdUpS7fO6HEcmRfTlwvt2KbegRn/cnNSgmW6gFaNF1S45DsOf1B+8qpSDseXVzV3WsiLNET8ekkrF3qGqnxJHvcPrvnQwrRQZQuH5salAyUeiqwO6EhJ8zSCYH74HF1CfgRB9vhV4BLQXDjzkFybbGIbE1i2jKCFB7a/DLaTxPx2LkzcjeZSoaSJmQAAAAA=";
byte[] tspBinaries = Utils.fromBase64(tspB64);
CertificatePool certPool = new CertificatePool();
TimeStampToken token = new TimeStampToken(new CMSSignedData(tspBinaries));
TimestampCertificateSource tcs = new TimestampCertificateSource(token, certPool);
assertEquals(4, tcs.getKeyInfoCertificates().size());
assertEquals(0, tcs.getEncapsulatedCertificates().size());
}
示例9: test
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
CertificateSource certSource = new CommonTrustedCertificateSource();
certSource.addCertificate(DSSUtils.loadCertificateFromBase64EncodedString(
"MIIDZDCCAkygAwIBAgICC7gwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCTFUxFjAUBgNVBAoTDUx1eFRydXN0IHMuYS4xHTAbBgNV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edCertSource(certSource);
SignatureValidationContext svc = new SignatureValidationContext();
svc.initialize(certificateVerifier);
CertificateToken certificateToken = DSSUtils.loadCertificateFromBase64EncodedString(
"MIIF7jCCBNagAwIBAgIDFL/YMA0GCSqGSIb3DQEBCwUAME4xCzAJBgNVBAYTAkxVMRYwFAYDVQQKEw1MdXhUcnVzdCBTLkEuMScwJQYDVQQDEx5MdXhUcnVzdCBHbG9iYWwgUXVhbGlmaWVkIENBIDIwHhcNMTUxMTIzMTAwMjM3WhcNMTgxMTIzMTAwMjM3WjCB7jELMAkGA1UEBhMCU0kxCzAJBgNVBAcTAkxVMRwwGgYDVQQKExNQdWJsaWNhdGlvbnMgT2ZmaWNlMQ4wDAYDVQQLEwUwMDAwMDEUMBIGA1UEAxMLSmFuZXogU2V2ZXIxDjAMBgNVBAQTBVNldmVyMQ4wDAYDVQQqEwVKYW5lejEdMBsGA1UEBRMUMTExMDU4NTg2MTAwNTQ5OTA2MDcxMTAvBgkqhkiG9w0BCQEWImphbmV6LnNldmVyQHB1YmxpY2F0aW9ucy5ldXJvcGEuZXUxHDAaBgNVBAwTE1Byb2Zlc3Npb25hbCBQZXJzb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwE1YtW/zh4eyHFpGGMOJWSDuEoTo2effHdypTurBlEObHNyHN3tZi3FS956p85WaYq6Dz4boI+HmbWb//e4RgcuKI1W7uazEkyMy5+O+qvZpBcGLgNJhfdlE3r/zI2JgXKaazkwvkM+zIzl9SbsdOg/FIY3+/0OPnkyvKWXLkoAnJp7ELyoQfA3v0tbHTndqnGEldlbRdhof0AcPRaDQSkXEJuM9getPyjjwZ3he4bnqGczjQh+4+Ay9trOmaXXoJfQMgxydw9hhIZiFzk4WxNpvmoHcPaxj754ZoXYWCt0AaUuV2FuNsX5SZ/6EO6zZaRvuTInvxVVLy71Wnezu/AgMBAAGjggIyMIICLjAMBgNVHRMBAf8EAjAAMGIGCCsGAQUFBwEBBFYwVDAjBggrBgEFB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Xj25Q==");
svc.addCertificateTokenForVerification(certificateToken);
svc.addCertificateTokenForVerification(certificateToken); // add twice for test
TimestampToken timestampToken = new TimestampToken(Utils.fromBase64(
"MIIIeQYJKoZIhvcNAQcCoIIIajCCCGYCAQMxDzANBglghkgBZQMEAgEFADCCARcGCyqGSIb3DQEJEAEEoIIBBgSCAQIwgf8CAQEGCisGAQQB+0sFAgIwMTANBglghkgBZQMEAgEFAAQglpOQ7OAK4W1yrehpc9Ru/cM4s30d+ckg6Z+3A76VxqcCFQD3FqBBui0KeqzF5Yw4rKBQ/CqmQhgTMjAxNzA0MjcwNjEwMzcuNDQzWjADgAEBAQH/AgkA9Q8FD+qHq56gfKR6MHgxKTAnBgNVBAMTIFVuaXZlcnNpZ24gVGltZXN0YW1waW5nIFVuaXQgMDE3MRwwGgYDVQQLExMwMDAyIDQzOTEyOTE2NDAwMDI2MSAwHgYDVQQKExdDcnlwdG9sb2cgSW50ZXJuYXRpb25hbDELMAkGA1UEBhMCRlKgggRhMIIEXTCCA0WgAwIBAgIRAIXfg8Wy+RxvNPq4ooTfu3gwDQYJKoZIhvcNAQELBQAwdzELMAkGA1UEBhMCRlIxIDAeBgNVBAoTF0NyeXB0b2xvZyBJbnRlcm5hdGlvbmFsMRwwGgYDVQQLExMwMDAyIDQzOTEyOTE2NDAwMDI2MSgwJgYDVQQDEx9Vbml2ZXJzaWduIFRpbWVzdGFtcGluZyBDQSAyMDE1MB4XDTE3MDMyMzEwMDcxMloXDTIzMDMyMzEwMDcxMloweDEpMCcGA1UEAxMgVW5pdmVyc2lnbiBUaW1lc3RhbXBpbmcgVW5pdCAwMTcxHDAaBgNVBAsTEzAwMDIgNDM5MTI5MTY0MDAwMjYxIDAeBgNVBAoTF0NyeXB0b2xvZyBJbnRlcm5hdGlvbmFsMQswCQYDVQQGEwJGUjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALvkTUmAEMbWX/8JNEsptM/ioLmOQAh3B9l7SMqeBGavDGwRfFQ51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zAwMDIgNDM5MTI5MTY0MDAwMjYxKDAmBgNVBAMTH1VuaXZlcnNpZ24gVGltZXN0YW1waW5nIENBIDIwMTUCEQCF34PFsvkcbzT6uKKE37t4MA0GCWCGSAFlAwQCAQUAoIIBEjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkEMSIEIF/5vrW6p1HJTWPzFj9+f+BC7fA6dqxqUSKUDEcnArVFMIHCBgsqhkiG9w0BCRACDDGBsjCBrzCBrDCBqQQUbvEQFkqwfgLnwZQ2qPkKt6JIND8wgZAwe6R5MHcxCzAJBgNVBAYTAkZSMSAwHgYDVQQKExdDcnlwdG9sb2cgSW50ZXJuYXRpb25hbDEcMBoGA1UECxMTMDAwMiA0MzkxMjkxNjQwMDAyNjEoMCYGA1UEAxMfVW5pdmVyc2lnbiBUaW1lc3RhbXBpbmcgQ0EgMjAxNQIRAIXfg8Wy+RxvNPq4ooTfu3gwDQYJKoZIhvcNAQELBQAEggEAIinJKkZU7I+6g1aSmh/7pbpbN8tLAiaQCS24G8MziaBfqP4aNyAXO0LChwFlELFXNH/AowZTj9PlP1ProPXRjli8arAO3D7drWRPJotdoG9ZkYf/4JFbKGpeogAVYk+vrfLSHhScm4gtXaffGgta29gFn8XjTLXtA89B8crfOjyiz0atbxXkL+7m0oj2iF+8N9y5pXfQ5JyYjC5Ni7HMmGnL4VDn9kd/sQXLcHw2Bq4BHL7tHXu4gRy3vHK05Z8JLP9AxpiGvXqgs9VjXLeYGv2t6oU2KQXUtqEfzzoflT4Ec5QsV9ukjEaZ0GRHb/pwHI7dmXzC27hpRacmztSgxA=="),
TimestampType.SIGNATURE_TIMESTAMP, new CertificatePool());
svc.addTimestampTokenForVerification(timestampToken);
svc.addTimestampTokenForVerification(timestampToken); // add twice for test
svc.validate();
Set<CertificateToken> processedCertificates = svc.getProcessedCertificates();
assertEquals(4, processedCertificates.size()); // cert chain + 1 cert for tsp
Set<TimestampToken> processedTimestamps = svc.getProcessedTimestamps();
assertEquals(1, processedTimestamps.size());
}
示例10: testCannotDownload
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
@Test
public void testCannotDownload() throws Exception {
CertificateVerifier certificateVerifier = new CommonCertificateVerifier();
CertificateSource certSource = new CommonTrustedCertificateSource();
certSource.addCertificate(DSSUtils.loadCertificateFromBase64EncodedString(
"MIIDZDCCAkygAwIBAgICC7gwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCTFUxFjAUBgNVBAoTDUx1eFRydXN0IHMuYS4xHTAbBgNVBAMTFEx1eFRydXN0IEdsb2JhbCBSb290MB4XDTExMDMxNzA5NTEzN1oXDTIxMDMxNzA5NTEzN1owRDELMAkGA1UEBhMCTFUxFjAUBgNVBAoTDUx1eFRydXN0IHMuYS4xHTAbBgNVBAMTFEx1eFRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsn+nQPAiygz267Hxyw6VV0B1r6A/Ps7sqjJX5hmxZ0OYWmt8s7j6eJyqpoSyYBuAQc5jzR8XCJmk9e8+EsdMsFeaXHhAePxFjdqRZ9w6Ubltc+a3OY52OrQfBfVpVfmTz3iISr6qm9d7R1tGBEyCFqY19vx039a0r9jitScRdFmiwmYsaArhmIiIPIoFdRTjuK7zCISbasE/MRivJ6VLm6T9eTHemD0OYcqHmMH4ijCc+j4z1aXEAwfh95Z0GAAnOCfRK6qq4UFFi2/xJcLcopeVx0IUM115hCNq52XAV6DYXaljAeew5Ivo+MVjuOVsdJA9x3f8K7p56aTGEnin/wIDAQABo2AwXjAMBgNVHRMEBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXFYWJCS8kh28/HRvk8pZ5g0gTzjAdBgNVHQ4EFgQUFxWFiQkvJIdvPx0b5PKWeYNIE84wDQYJKoZIhvcNAQELBQADggEBAFrwHNDUUM9Bfua4nX3DcNBeNv9ujnov3kgR1TQuPLdFwlQlp+HBHjeDtpSutkVIA+qVvuucarQ3XB8u02uCgUNbCj8RVWOs+nwIAjegPDkEM/6XMshS5dklTbDG7mgfcKpzzlcD3H0KDTPy0lrfCmw7zBFRlxqkIaKFNQLXgCLShLL4wKpov9XrqsMLq6F8K/f1O4fhVFfsBSTveUJO84ton+Ruy4KZycwq3FPCH3CDqyEPVrRI/98HIrOM+R2mBN8tAza53W/+MYhm/2xtRDSvCHc+JtJy9LtHVpM8mGPhM7uZI5K1g3noHZ9nrWLWidb2/CfeMifLhNp3hSGhEiE="));
certificateVerifier.setTrustedCertSource(certSource);
certificateVerifier.setDataLoader(new IgnoreDataLoader());
ValidationContext vc = new SignatureValidationContext();
vc.initialize(certificateVerifier);
CertificateToken certificateToken = DSSUtils.loadCertificateFromBase64EncodedString(
"MIIF7jCCBNagAwIBAgIDFL/YMA0GCSqGSIb3DQEBCwUAME4xCzAJBgNVBAYTAkxVMRYwFAYDVQQKEw1MdXhUcnVzdCBTLkEuMScwJQYDVQQDEx5MdXhUcnVzdCBHbG9iYWwgUXVhbGlmaWVkIENBIDIwHhcNMTUxMTIzMTAwMjM3WhcNMTgxMTIzMTAwMjM3WjCB7jELMAkGA1UEBhMCU0kxCzAJBgNVBAcTAkxVMRwwGgYDVQQKExNQdWJsaWNhdGlvbnMgT2ZmaWNlMQ4wDAYDVQQLEwUwMDAwMDEUMBIGA1UEAxMLSmFuZXogU2V2ZXIxDjAMBgNVBAQTBVNldmVyMQ4wDAYDVQQqEwVKYW5lejEdMBsGA1UEBRMUMTExMDU4NTg2MTAwNTQ5OTA2MDcxMTAvBgkqhkiG9w0BCQEWImphbmV6LnNldmVyQHB1YmxpY2F0aW9ucy5ldXJvcGEuZXUxHDAaBgNVBAwTE1Byb2Zlc3Npb25hbCBQZXJzb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwE1YtW/zh4eyHFpGGMOJWSDuEoTo2effHdypTurBlEObHNyHN3tZi3FS956p85WaYq6Dz4boI+HmbWb//e4Rg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gRy3vHK05Z8JLP9AxpiGvXqgs9VjXLeYGv2t6oU2KQXUtqEfzzoflT4Ec5QsV9ukjEaZ0GRHb/pwHI7dmXzC27hpRacmztSgxA=="),
TimestampType.SIGNATURE_TIMESTAMP, new CertificatePool());
vc.addTimestampTokenForVerification(timestampToken);
vc.validate();
Set<CertificateToken> processedCertificates = vc.getProcessedCertificates();
assertEquals(2, processedCertificates.size()); // cert + tsp cert
Set<TimestampToken> processedTimestamps = vc.getProcessedTimestamps();
assertEquals(1, processedTimestamps.size());
}
示例11: getToBeSigned
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
private ToBeSigned getToBeSigned(DigestAlgorithm digest) {
if (toBeSignedsByDigest.containsKey(digest)) {
return toBeSignedsByDigest.get(digest);
} else {
ToBeSigned dataToSign = new ToBeSigned(Utils.fromBase64(dssDocument.getDigest(digest)));
toBeSignedsByDigest.put(digest, dataToSign);
return dataToSign;
}
}
示例12: loadOCSPBase64Encoded
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* This method loads an OCSP response from the given base 64 encoded string.
*
* @param base64Encoded
* base 64 encoded OCSP response
* @return {@code BasicOCSPResp}
* @throws IOException
* @throws OCSPException
*/
public static BasicOCSPResp loadOCSPBase64Encoded(final String base64Encoded) throws IOException, OCSPException {
final byte[] derEncoded = Utils.fromBase64(base64Encoded);
final OCSPResp ocspResp = new OCSPResp(derEncoded);
final BasicOCSPResp basicOCSPResp = (BasicOCSPResp) ocspResp.getResponseObject();
return basicOCSPResp;
}
示例13: loadCertificateFromBase64EncodedString
import eu.europa.esig.dss.utils.Utils; //导入方法依赖的package包/类
/**
* This method loads a certificate from a base 64 encoded String
*
* @param base64Encoded
* @return
*/
public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) {
final byte[] bytes = Utils.fromBase64(base64Encoded);
return loadCertificate(bytes);
}