privKey = kFact.generatePrivate(RSA_PRIVATE_KEY_SPEC);
X509V2AttributeCertificateGenerator gen = new X509V2AttributeCertificateGenerator();
// the actual attributes
GeneralName roleName = new GeneralName(GeneralName.rfc822Name,
"DAU123456789@test.com");
ASN1EncodableVector roleSyntax = new ASN1EncodableVector();
roleSyntax.add(roleName);
// roleSyntax OID: 2.5.24.72
X509Attribute attributes = new X509Attribute("2.5.24.72",
new DERSequence(roleSyntax));
gen.addAttribute(attributes);
gen.setHolder(new AttributeCertificateHolder(PrincipalUtil.getSubjectX509Principal(iCert)));
gen.setIssuer(new AttributeCertificateIssuer(new X509Principal(
"cn=test")));
gen.setNotBefore(new Date(System.currentTimeMillis() - 50000));
gen.setNotAfter(new Date(System.currentTimeMillis() + 50000));
gen.setSerialNumber(BigInteger.valueOf(1));
gen.setSignatureAlgorithm("SHA1WithRSAEncryption");
Target targetName = new Target(Target.targetName, new GeneralName(GeneralName.dNSName,
"www.test.com"));
Target targetGroup = new Target(Target.targetGroup, new GeneralName(
GeneralName.directoryName, "o=Test, ou=Test"));
Target[] targets = new Target[2];
targets[0] = targetName;
targets[1] = targetGroup;
TargetInformation targetInformation = new TargetInformation(targets);