List of usage examples for org.bouncycastle.asn1.x509 GeneralName rfc822Name
int rfc822Name
To view the source code for org.bouncycastle.asn1.x509 GeneralName rfc822Name.
Click Source Link
From source file:test.unit.be.fedict.trust.TrustTestUtils.java
License:Open Source License
public static X509V2AttributeCertificate createAttributeCertificate(X509Certificate holderCertificate, X509Certificate issuerCertificate, PrivateKey issuerPrivateKey, Date notBefore, Date notAfter) throws Exception { X509V2AttributeCertificateGenerator acGen = new X509V2AttributeCertificateGenerator(); acGen.reset();/*from ww w . java 2s.c o m*/ acGen.setHolder(new AttributeCertificateHolder(holderCertificate)); acGen.setIssuer(new AttributeCertificateIssuer(issuerCertificate.getSubjectX500Principal())); acGen.setSerialNumber(new BigInteger("1")); acGen.setNotBefore(notBefore); acGen.setNotAfter(notAfter); acGen.setSignatureAlgorithm("SHA512WithRSAEncryption"); GeneralName roleName = new GeneralName(GeneralName.rfc822Name, "RoleName"); ASN1EncodableVector roleSyntax = new ASN1EncodableVector(); roleSyntax.add(roleName); X509Attribute attributes = new X509Attribute("2.5.24.72", new DERSequence(roleSyntax)); acGen.addAttribute(attributes); return (X509V2AttributeCertificate) acGen.generate(issuerPrivateKey, "BC"); }