public boolean importTrustCert(String fileName, String alias) throws FileNotFoundException, CertificateException {
// Uploading certificate using a disk file fails on Windows. Certificate text is used instead.
//InputStream is = new FileInputStream(fileName);
InputStream is = new ByteArrayInputStream(fileName.getBytes());
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Collection certs = cf.generateCertificates(is);
X509Certificate cert = (X509Certificate) certs.iterator().next();
boolean result = instance.importTrustCertificate(cert, alias, password);
if(result) {
String[] update = new String[certificates.length+1];
System.arraycopy(certificates, 0, update, 0, certificates.length);