private void connect()
throws ManifoldCFException
{
try
{
LLValue configuration;
if (useHttp)
{
boolean useNTLM;
String userNameAndDomain;
if (httpNtlmDomain != null && httpNtlmUser != null)
{
useNTLM = true;
userNameAndDomain = httpNtlmDomain + "\\" + httpNtlmUser;
}
else
{
useNTLM = false;
userNameAndDomain = httpNtlmUser;
}
configuration = new LLValue();
configuration.setAssoc();
configuration.add("Encoding","UTF-8");
configuration.add("LivelinkCGI", httpCgiPath);
if (userNameAndDomain != null)
{
configuration.add("HTTPUserName", userNameAndDomain);
configuration.add("HTTPPassword", httpNtlmPassword);
}
if (useNTLM)
configuration.add("EnableNTLM", LLValue.LL_TRUE);
else
configuration.add("EnableNTLM", LLValue.LL_FALSE);
if (useSSL)
{
configuration.add("HTTPS", LLValue.LL_TRUE);
// Create the place to put the certs
createCertFolder();
if (keystore != null)
{
// Now, write the certs themselves
String[] aliases = keystore.getContents();
for (String alias : aliases)
{
java.security.cert.Certificate cert = keystore.getCertificate(alias);
byte[] certData = cert.getEncoded();
File fileName = new File(certFolder,ManifoldCF.safeFileName(alias) + ".cer");
OutputStream fos = new FileOutputStream(fileName);
try
{
Writer osw = new OutputStreamWriter(fos,StandardCharsets.UTF_8);
try
{
String certBase64 = new Base64().encodeByteArray(certData);
osw.write("-----BEGIN CERTIFICATE-----\n");
int index = 0;
while (true)
{
if (certBase64.length() - index > 64)
{
osw.write(certBase64.substring(index,index+64) + "\n");
index += 64;
}
else
{
osw.write(certBase64.substring(index) + "\n");
break;
}
}
osw.write("-----END CERTIFICATE-----\n");
}
finally
{
osw.flush();
}
}
finally
{
fos.flush();
fos.close();
}
}
}
LLValue rootCACertList = new LLValue();
LLSession.GetCARootCerts(certFolder.toString(),rootCACertList);
configuration.add("CARootCerts", rootCACertList);
}
}
else