org.bouncycastle.asn1.test.ExtensionReqTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-ext-jdk15on Show documentation
Show all versions of bcprov-ext-jdk15on 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.5 to JDK 1.8. Note: this package includes the NTRU encryption algorithms.
package org.bouncycastle.asn1.test;
import org.bouncycastle.asn1.ASN1Boolean;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.cmc.ExtensionReq;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.util.test.SimpleTest;
public class ExtensionReqTest
extends SimpleTest
{
public String getName()
{
return "ExtensionReqTest";
}
public void performTest()
throws Exception
{
ExtensionReq extensionReq = new ExtensionReq(
new Extension(
new ASN1ObjectIdentifier("1.2.4"), ASN1Boolean.FALSE, new DEROctetString("abcdef".getBytes())
));
byte[] b = extensionReq.getEncoded();
ExtensionReq extensionReqResult = ExtensionReq.getInstance(b);
isEquals("Extensions", extensionReq.getExtensions()[0], extensionReqResult.getExtensions()[0]);
}
public static void main(String[] args)
{
runTest(new ExtensionReqTest());
}
}