Example usage for org.bouncycastle.cert X509AttributeCertificateHolder getEncoded

List of usage examples for org.bouncycastle.cert X509AttributeCertificateHolder getEncoded

Introduction

In this page you can find the example usage for org.bouncycastle.cert X509AttributeCertificateHolder getEncoded.

Prototype

public byte[] getEncoded() throws IOException 

Source Link

Document

Return the ASN.1 encoding of this holder's attribute certificate.

Usage

From source file:FileTransferPackage.FileDownload.java

public String downloadAC() {
    System.out.println("Client downloading AC");
    File dir = new File(servletReq.getSession().getServletContext().getRealPath("/") + "/GeneratedACs");
    File[] files = dir.listFiles();
    X509AttributeCertificateHolder ac = null;

    for (File f : files) {
        //Skip .DS_Store and the chain directory
        if (f.getName().equalsIgnoreCase(".DS_Store") || f.isDirectory()) {
            continue;
        }//  w  w w.j  a v  a2  s.  c o m

        ac = ACHelper.loadAttributeCertFromFile(f);
        try {
            stream = new ByteArrayInputStream(ac.getEncoded());
        } catch (IOException ex) {
            Logger.getLogger(FileDownload.class.getName()).log(Level.SEVERE, null, ex);
            return "failure";
        }
        f.delete();
    }

    return SUCCESS;
}

From source file:org.italiangrid.voms.aa.x509.impl.ACGeneratorImpl.java

License:Apache License

@Override
public byte[] generateVOMSAC(RequestContext context) throws IOException {

    if (!configured)
        throw new IllegalStateException("AC generator is not configured!");

    BigInteger serialNo = computeSerialNumber();

    X509AttributeCertificateHolder ac = acGenerator.generateVOMSAttributeCertificate(
            context.getResponse().getIssuedFQANs(), context.getResponse().getIssuedGAs(),
            context.getResponse().getTargets(), context.getRequest().getHolderCert(), serialNo,
            context.getResponse().getNotBefore(), context.getResponse().getNotAfter(), context.getVOName(),
            context.getHost(), context.getPort());

    return ac.getEncoded();
}