本文整理汇总了Java中org.bouncycastle.tsp.TimeStampResponse.validate方法的典型用法代码示例。如果您正苦于以下问题:Java TimeStampResponse.validate方法的具体用法?Java TimeStampResponse.validate怎么用?Java TimeStampResponse.validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.tsp.TimeStampResponse
的用法示例。
在下文中一共展示了TimeStampResponse.validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTimestampViaSpy
import org.bouncycastle.tsp.TimeStampResponse; //导入方法依赖的package包/类
@Test
public void getTimestampViaSpy() throws Exception {
stubFor(post(urlEqualTo("/"))
.willReturn(aResponse()
.proxiedFrom(configuration.getTspSource())));
byte[] tsRequest = new byte[]{48, 57, 2, 1, 1, 48, 49, 48, 13, 6, 9, 96, -122, 72, 1, 101, 3, 4, 2, 1, 5, 0, 4, 32, 2, 91, 64, 111, 35, -23, -19, -46, 57, -80, -63, -80, -74, 100, 72, 97, -47, -17, -35, -62, 102, 52, 116, 73, -10, -120, 115, 62, 2, 87, -29, -21, 1, 1, -1};
SkDataLoader dataLoader = SkDataLoader.createTimestampDataLoader(configuration);
dataLoader.setUserAgentSignatureProfile(SignatureProfile.LT);
byte[] response = dataLoader.post(MOCK_PROXY_URL, tsRequest);
assertNotNull(response);
TimeStampResponse timeStampResponse = new TimeStampResponse(response);
assertEquals(0, timeStampResponse.getStatus());
timeStampResponse.validate(new TimeStampRequest(tsRequest));
verify(postRequestedFor(urlMatching("/")).
withHeader("Content-Type", containing("application/timestamp-query")).
withHeader("User-Agent", containing("LIB DigiDoc4j")));
}
示例2: responseParse
import org.bouncycastle.tsp.TimeStampResponse; //导入方法依赖的package包/类
private void responseParse(
byte[] request,
byte[] response,
ASN1ObjectIdentifier algorithm)
throws Exception
{
TimeStampRequest req = new TimeStampRequest(request);
TimeStampResponse resp = new TimeStampResponse(response);
CertificateFactory fact = CertificateFactory.getInstance("X.509", "BC");
X509Certificate cert = (X509Certificate)fact.generateCertificate(new ByteArrayInputStream(signingCert));
resp.validate(req);
resp.getTimeStampToken().validate(cert, "BC");
}