Package org.apache.geronimo.management.geronimo

Examples of org.apache.geronimo.management.geronimo.CertificationAuthorityException


            caCert = caKeystore.getCertificate(alias, password);
            caName = CaUtils.getSubjectX509Name(caCert);
            caPrivateKey = caKeystore.getPrivateKey(alias, password, password);
            caPublicKey = caCert.getPublicKey();
        } catch(Exception e) {
            throw new CertificationAuthorityException("Errors in unlocking CA.", e);
        }
    }
View Full Code Here


    /**
     * This method returns CA's name.
     * @throws Exception if CA is locked.
     */
    public X500Principal getName() throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            return new X500Principal(caName.getEncoded());
        } catch (IOException e) {
            throw new CertificationAuthorityException("Error in getting CA name.", e);
        }
    }
View Full Code Here

    /**
     * This method returns CA's own certificate.
     * @throws Exception if CA is locked.
     */
    public Certificate getCertificate() throws CertificationAuthorityException {
        if(caCert == null) throw new CertificationAuthorityException("CA Certificate is null. CA may be locked.");
        try {
            return caCert = caKeystore.getCertificate(alias, password);
        } catch (KeystoreException e) {
            log.error("Error getting CA's certificate.", e);
        }
View Full Code Here

     * @param validFromDate Certificate validity period start date
     * @param validToDate Certificate validity period end date
     * @param algorithm Signature algorithm for self-signed certificate
     */
    public void issueOwnCertificate(BigInteger sNo, Date validFromDate, Date validToDate, String algorithm) throws CertificationAuthorityException{
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            PublicKey publicKey = caCert.getPublicKey();
            Certificate cert = issueCertificate(getName(), publicKey, sNo, validFromDate, validToDate, algorithm);
            caKeystore.importPKCS7Certificate(alias, CaUtils.base64Certificate(cert), password);
            caCert = cert;
        } catch(Exception e) {
            throw new CertificationAuthorityException("Error in issuing own certificate.", e);
        }
    }
View Full Code Here

     * @param validToDate Certificate validity period end date
     * @param algorithm Signature algorithm for the certificate
     * @return newly issued certificate
     */
    public Certificate issueCertificate(X500Principal subject, PublicKey publicKey, BigInteger sNo, Date validFromDate, Date validToDate, String algorithm) throws CertificationAuthorityException{
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            X509Name subName = CaUtils.getX509Name(subject);
            Certificate cert = issueCertificate(subName, caName, sNo, publicKey, caPrivateKey, validFromDate, validToDate, algorithm);
            cert.verify(caPublicKey);
            certStore.storeCertificate(cert);
            return cert;
        } catch(Exception e) {
            throw new CertificationAuthorityException("Error in issuing certificate.", e);
        }
    }
View Full Code Here

   
    /**
     * This method returns the highest serial number used by the CA.
     */
    public BigInteger getHighestSerialNumber() throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            return certStore.getHighestSerialNumber();
        } catch (CertificateStoreException e) {
            throw new CertificationAuthorityException("Error in getting highest serial number for CA.", e);
        }
    }
View Full Code Here

     * This method checks if a Certificate with a given serial number is already issued.
     * @param sNo The serial number of the the certificate to be looked for
     * @return true if a certificate with the specified serial number has already been issued
     */
    public boolean isCertificateIssued(BigInteger sNo) throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        return certStore.containsCertificate(sNo);
    }
View Full Code Here

    /**
     * This method returns the next serial number that can be used to issue a certificate and increments the
     * highest serial number.
     */
    public BigInteger getNextSerialNumber() throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            return certStore.getNextSerialNumber();
        } catch (CertificateStoreException e) {
            throw new CertificationAuthorityException("Error in getting next serial number for CA.", e);
        }
    }
View Full Code Here

     * This method retrieves a certificate with the specified serial number.
     * @param sNo The serial number of the certificate to be retrieved
     * @return java.security.cert.Certificate instance of the certificate
     */
    public Certificate getCertificate(BigInteger sNo) throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            return certStore.getCertificate(sNo);
        } catch (CertificateStoreException e) {
            throw new CertificationAuthorityException("Error getting certificate. serial number = "+sNo, e);
        }
    }
View Full Code Here

     * This method retrieves a certificate with the specified serial number.
     * @param sNo The serial number of the certificate to be retrieved
     * @return base64 encoded certificate text
     */
     public String getCertificateBase64Text(BigInteger sNo) throws CertificationAuthorityException {
        if(isLocked()) throw new CertificationAuthorityException("CA is locked.");
        try {
            return certStore.getCertificateBase64Text(sNo);
        } catch (CertificateStoreException e) {
            throw new CertificationAuthorityException("Error getting certificate. serial number = "+sNo, e);
        }
    }
View Full Code Here

TOP

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

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.