Ejemplo n.º 1
0
 public void writeToFile(File certFile, File keyFile)
     throws IOException, CertificateEncodingException {
   FileOutputStream keyOutputStream = null;
   FileOutputStream certOutputStream = null;
   try {
     keyOutputStream = new FileOutputStream(keyFile);
     certOutputStream = new FileOutputStream(certFile);
     saveKey(keyOutputStream);
     saveCertificateChain(certOutputStream);
   } finally {
     try {
       if (keyOutputStream != null) {
         keyOutputStream.close();
       }
     } catch (IOException e) {
       logger.warn("Could not close stream on save of key to file. " + keyFile.getPath());
     }
     try {
       if (certOutputStream != null) {
         certOutputStream.close();
       }
     } catch (IOException e) {
       logger.warn(
           "Could not close stream on save certificate chain to file. " + certFile.getPath());
     }
   }
 }