try {
// 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();
instance.importTrustCertificate(cert, alias, password);
String[] update = new String[certificates.length+1];
System.arraycopy(certificates, 0, update, 0, certificates.length);
update[certificates.length] = alias;