org.bouncycastle.asn1.test.TaggedCertificationRequestTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-debug-jdk14 Show documentation
Show all versions of bcprov-debug-jdk14 Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.4.
package org.bouncycastle.asn1.test;
import org.bouncycastle.asn1.cmc.BodyPartID;
import org.bouncycastle.asn1.cmc.CertificationRequest;
import org.bouncycastle.asn1.cmc.TaggedCertificationRequest;
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.test.SimpleTest;
public class TaggedCertificationRequestTest extends SimpleTest
{
public static void main(String[] args) {
runTest(new TaggedCertificationRequestTest());
}
public String getName()
{
return "TaggedCertificationRequestTest";
}
private static byte[] req1 = Base64.decode(
"MIHoMIGTAgEAMC4xDjAMBgNVBAMTBVRlc3QyMQ8wDQYDVQQKEwZBbmFUb20xCzAJBgNVBAYTAlNF"
+ "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALlEt31Tzt2MlcOljvacJgzQVhmlMoqAOgqJ9Pgd3Gux"
+ "Z7/WcIlgW4QCB7WZT21O1YoghwBhPDMcNGrHei9kHQkCAwEAAaAAMA0GCSqGSIb3DQEBBQUAA0EA"
+ "NDEI4ecNtJ3uHwGGlitNFq9WxcoZ0djbQJ5hABMotav6gtqlrwKXY2evaIrsNwkJtNdwwH18aQDU"
+ "KCjOuBL38Q==");
public void performTest()
throws Exception
{
CertificationRequest r = CertificationRequest.getInstance(req1);
TaggedCertificationRequest tcr = new TaggedCertificationRequest(new BodyPartID(10L), r);
byte[] b = tcr.getEncoded();
TaggedCertificationRequest tcrResp = TaggedCertificationRequest.getInstance(b);
isEquals(tcrResp,tcr);
}
}