Search in sources :

Example 6 with File

use of com.intel.mtwilson.datatypes.File in project OpenAttestation by OpenAttestation.

the class Global method cacerts.

public static List<X509Certificate> cacerts() {
    if (cacerts == null) {
        log.debug("Loading CA cert...");
        FileDAO fileDao = null;
        try {
            fileDao = TagJdbi.fileDao();
            File cacertFile = fileDao.findByName("cacerts");
            if (cacertFile == null) {
                log.debug("Cannot find 'cacert' file");
            } else {
                cacerts = X509Util.decodePemCertificates(new String(cacertFile.getContent(), "UTF-8"));
            }
        } catch (Exception e) {
            log.error("Cannot load cacerts", e);
            cacerts = null;
        } finally {
            if (fileDao != null) {
                fileDao.close();
            }
        }
    }
    return cacerts;
}
Also used : File(com.intel.mtwilson.datatypes.File) IOException(java.io.IOException)

Aggregations

File (com.intel.mtwilson.datatypes.File)6 IOException (java.io.IOException)4 X509Certificate (java.security.cert.X509Certificate)2 ASException (com.intel.mountwilson.as.common.ASException)1 ApiClient (com.intel.mtwilson.ApiClient)1 ApiException (com.intel.mtwilson.ApiException)1 CryptographyException (com.intel.mtwilson.crypto.CryptographyException)1 X509Builder (com.intel.mtwilson.crypto.X509Builder)1 X509AttributeCertificate (com.intel.mtwilson.datatypes.X509AttributeCertificate)1 FileDAO (com.intel.mtwilson.tag.dao.jdbi.FileDAO)1 UUID (com.intel.mtwilson.util.io.UUID)1 Fault (com.intel.mtwilson.util.validation.Fault)1 FileOutputStream (java.io.FileOutputStream)1 KeyManagementException (java.security.KeyManagementException)1 KeyPair (java.security.KeyPair)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 SignatureException (java.security.SignatureException)1 CertificateException (java.security.cert.CertificateException)1