Example usage for org.bouncycastle.asn1.x509 AttributeCertificateInfo AttributeCertificateInfo

List of usage examples for org.bouncycastle.asn1.x509 AttributeCertificateInfo AttributeCertificateInfo

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.x509 AttributeCertificateInfo AttributeCertificateInfo.

Prototype

private AttributeCertificateInfo(ASN1Sequence seq) 

Source Link

Usage

From source file:nl.uva.vlet.grid.voms.VOMSAttributeCertificate.java

License:Apache License

public VOMSAttributeCertificate(String holderString, int holderSerialNumber, String issuerString,
        int productionSerial, long fromEpoch, long toEpoch, String[] fqans) throws Exception {
    try {/*from  w w w  .  j a  v  a  2s.c  o m*/
        DEREncodableVector infoVector = new ASN1EncodableVector();

        this.setVersion();
        this.setHolder(holderString, holderSerialNumber);
        this.setIssuer(issuerString);
        this.setAlgorithmIdentifier();
        this.setSerialNumber(productionSerial);
        this.setTimes(new Date(fromEpoch), new Date(toEpoch));
        this.setVOMSFQANs(fqans);
        this.setExtensions();

        infoVector.add(version);
        infoVector.add(holder);
        infoVector.add(issuer);
        infoVector.add(signature);
        infoVector.add(serialNumber);
        infoVector.add(attrCertValidityPeriod);
        infoVector.add(attributes);
        infoVector.add(extensions);

        ASN1Sequence infoSequence = ASN1Sequence.getInstance(new DERSequence(infoVector));

        this.acinfo = new AttributeCertificateInfo(infoSequence);

        // Do it this way to match Vincenzo as much as possible
        // - rather than this way... this.signatureAlgorithm = new AlgorithmIdentifier( "1.2.840.113549.1.1.4" ) ;
        this.signatureAlgorithm = new AlgorithmIdentifier(new DERObjectIdentifier("1.2.840.113549.1.1.4"),
                (DEREncodable) null);

        this.signatureValue = new DERBitString(this.sign());

        this.ac = new AttributeCertificate(acinfo, signatureAlgorithm, signatureValue);

    } catch (Exception e) {
        // inspect?: 
        throw e;
    }

}