Package org.apache.geronimo.management.geronimo

Examples of org.apache.geronimo.management.geronimo.CertificateStoreException


            // Store the certificate to disk in base64 format
            FileOutputStream fout = new FileOutputStream(certFile);
            CaUtils.storeInBase64(fout, cert.getEncoded(), CaUtils.CERT_HEADER, CaUtils.CERT_FOOTER, CaUtils.B64_LINE_SIZE);
            fout.close();
        } catch (Exception e) {
            throw new CertificateStoreException("Error while storing certificate.", e);
        }
    }
View Full Code Here


     */
    public Certificate getCertificate(BigInteger sNo) throws CertificateStoreException {
        File certFile = new File(storeDir, sNo+CERT_FILE_SUFFIX);
        if(!certFile.exists()) {
            // No such certificate in the store.
            throw new CertificateStoreException("No certificate with serial number "+sNo+" found.");
        }
       
        // Read the certificate from disk and generate a java.security.cert.Certificate
        try {
            FileInputStream fin = new FileInputStream(certFile);
            CertificateFactory certFac = CertificateFactory.getInstance("X.509");
            Certificate cert = certFac.generateCertificate(fin);
            fin.close();
            return cert;
        } catch (Exception e) {
            throw new CertificateStoreException("Error while retrieving certificate.", e);
        }
    }
View Full Code Here

     * @param sNo Serial Number of the certificate to be retrieved.
     */
    public String getCertificateBase64Text(BigInteger sNo) throws CertificateStoreException {
        File certFile = new File(storeDir, sNo+CERT_FILE_SUFFIX);
        if(!certFile.exists()) {
            throw new CertificateStoreException("No certificate with serial number "+sNo+" found.");
        }
        FileInputStream fin;
        try {
            fin = new FileInputStream(certFile);
            byte[] data = new byte[fin.available()];
            fin.read(data);
            fin.close();
            return new String(data);
        } catch (Exception e) {
            throw new CertificateStoreException("Error while retrieving certificate.", e);
        }
    }
View Full Code Here

                byte[] data = new byte[finp.available()];
                finp.read(data);
                finp.close();
                highestSerialNumber = new BigInteger(new String(data).trim());
            } catch (Exception e) {
                throw new CertificateStoreException("Error while getting serial number.", e);
            }
        }
        return highestSerialNumber;
    }
View Full Code Here

            highestSerialNumber = sNo;
            FileOutputStream fout = new FileOutputStream(highestSerialFile);
            fout.write(highestSerialNumber.toString().getBytes());
            fout.close();
        } catch (Exception e) {
            throw new CertificateStoreException("Error while setting highest serial number.", e);
        }
    }
View Full Code Here

            fout = new FileOutputStream(new File(storeDir, CA_CERT_FILE));
            CaUtils.storeInBase64(fout, cert.getEncoded(), CaUtils.CERT_HEADER, CaUtils.CERT_FOOTER, CaUtils.B64_LINE_SIZE);
            fout.close();
            return true;
        } catch (Exception e) {
            throw new CertificateStoreException("Exception in storing CA certificate", e);
        }
    }
View Full Code Here

            CertificateFactory certFac = CertificateFactory.getInstance("X.509");
            Certificate cert = certFac.generateCertificate(fin);
            fin.close();
            return cert;
        } catch (Exception e) {
            throw new CertificateStoreException("Exception in getting CA certificate", e);
        }
    }
View Full Code Here

            // Store the certificate to disk in base64 format
            FileOutputStream fout = new FileOutputStream(certFile);
            CaUtils.storeInBase64(fout, cert.getEncoded(), CaUtils.CERT_HEADER, CaUtils.CERT_FOOTER, CaUtils.B64_LINE_SIZE);
            fout.close();
        } catch (Exception e) {
            throw new CertificateStoreException("Error while storing certificate.", e);
        }
    }
View Full Code Here

     */
    public Certificate getCertificate(BigInteger sNo) throws CertificateStoreException {
        File certFile = new File(storeDir, sNo+CERT_FILE_SUFFIX);
        if(!certFile.exists()) {
            // No such certificate in the store.
            throw new CertificateStoreException("No certificate with serial number "+sNo+" found.");
        }
       
        // Read the certificate from disk and generate a java.security.cert.Certificate
        try {
            FileInputStream fin = new FileInputStream(certFile);
            CertificateFactory certFac = CertificateFactory.getInstance("X.509");
            Certificate cert = certFac.generateCertificate(fin);
            fin.close();
            return cert;
        } catch (Exception e) {
            throw new CertificateStoreException("Error while retrieving certificate.", e);
        }
    }
View Full Code Here

     * @param sNo Serial Number of the certificate to be retrieved.
     */
    public String getCertificateBase64Text(BigInteger sNo) throws CertificateStoreException {
        File certFile = new File(storeDir, sNo+CERT_FILE_SUFFIX);
        if(!certFile.exists()) {
            throw new CertificateStoreException("No certificate with serial number "+sNo+" found.");
        }
        FileInputStream fin;
        try {
            fin = new FileInputStream(certFile);
            byte[] data = new byte[fin.available()];
            fin.read(data);
            fin.close();
            return new String(data);
        } catch (Exception e) {
            throw new CertificateStoreException("Error while retrieving certificate.", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.management.geronimo.CertificateStoreException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.