* encoded form.
*
*/
public void testCertificationRequestInfo() throws IOException {
int version = 2;// X.509 v3
Name subject = new Name("O=subject");
SubjectPublicKeyInfo spki = new SubjectPublicKeyInfo(
new AlgorithmIdentifier("1.2.840.113549.1.1.2"), new byte[4]);
List attributes = new ArrayList();
// 1.2.840.113549.1.9.1 is OID of EMAILADDRESS
attributes.add(new AttributeTypeAndValue("1.2.840.113549.1.9.1",
new AttributeValue("a@b.com", false)));
CertificationRequestInfo certReqInfo = new CertificationRequestInfo(
version, subject, spki, attributes);
// check what we have constructed
assertEquals(version, certReqInfo.getVersion());
assertEquals(subject.getName(X500Principal.RFC1779), certReqInfo
.getSubject().getName(X500Principal.RFC1779));
assertTrue(Arrays.equals(spki.getEncoded(), certReqInfo
.getSubjectPublicKeyInfo().getEncoded()));
assertEquals(attributes, certReqInfo.getAttributes());