Package org.glite.authz.pap.common.exceptions

Examples of org.glite.authz.pap.common.exceptions.PAPCertificateException


    public void checkCertificate(String pathToCert){
       
        File certFile = new File(pathToCert);
       
        if (!certFile.exists())
            throw new PAPCertificateException("Certificate file '"+pathToCert+"' does not exist!");
       
        if (!certFile.canRead())
            throw new PAPCertificateException("Certificate file '"+pathToCert+"' is not readable!");
       
        X509Certificate serviceCert = null;
       
        try {
            FileInputStream fis = new FileInputStream(certFile);
           
            serviceCert = (X509Certificate) certificateFactory.generateCertificate( fis );
           
            if (serviceCert == null)
                throw new PAPCertificateException("Certificate could not be generated!");
           
            serviceCert.checkValidity();
       
        } catch ( FileNotFoundException e ) {
           
            throw new PAPCertificateException("Certificate file '"+pathToCert+"' does not exist!");
           
        } catch ( CertificateExpiredException e ) {
            throw new PAPCertificateException("Certificate '"+pathToCert+"' has expired!",e);
           
        } catch ( CertificateNotYetValidException e ) {
            throw new PAPCertificateException("Certificate '"+pathToCert+"' isn't yet valid!",e);
           
        } catch ( CertificateException e ) {
            throw new PAPCertificateException("Error parsing certificate file '"+pathToCert+"': "+ e.getMessage(),e);
       
       
    }
View Full Code Here


     */
    public void checkPrivateKey(String pathToKey){
       
        File keyFile = new File(pathToKey);
        if (!keyFile.exists())
            throw new PAPCertificateException("Private key file '"+pathToKey+"' doesn't exist!");
    }
View Full Code Here

TOP

Related Classes of org.glite.authz.pap.common.exceptions.PAPCertificateException

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.