Alachisoft.NCache.Common.Communication.Secure.SslConfiguration Maven / Gradle / Ivy
package Alachisoft.NCache.Common.Communication.Secure;
//todo 5.0 sp3 SSL Communication
public final class SslConfiguration {
private static final Object snycer = new Object();
private static String sCertificateName, sThumbprint;
private static boolean sIsLoaded, sSslConnectionEnabled, sReqClientCertificate;
public static boolean getSslConnectionEnabled() {
loadConfiguration();
return sSslConnectionEnabled;
}
public static String getCertificateName() {
loadConfiguration();
return sCertificateName;
}
public static String getThumbprint() {
loadConfiguration();
return sThumbprint;
}
public static boolean getRequireClientCertificate() {
loadConfiguration();
return sReqClientCertificate;
}
//todo 5.0 sp3 SSL Communication
// public static SslProtocols getSslProtocols()
// {
// return SslProtocols.forValue(3072);
// }
//
// public static EncryptionPolicy getEncryptionPolicy()
// {
// return EncryptionPolicy.RequireEncryption;
// }
private static void loadConfiguration() {
synchronized (snycer) {
if (!sIsLoaded) {
loadFromRegistery();
sIsLoaded = true;
}
}
}
//todo 5.0 sp3 SSL Communication
private static void loadFromRegistery() {
// int enabledValue;
// tangible.OutObject tempOutEnabledValue = new tangible.OutObject();
// if (!getRegValue("Enabled", tempOutEnabledValue))
// {
// enabledValue = tempOutEnabledValue.argValue;
// return;
// }
// else
// {
// enabledValue = tempOutEnabledValue.argValue;
// }
// if (!(sSslConnectionEnabled = enabledValue == 1))
// {
// return;
// }
//
// int clientCertValue;
// tangible.OutObject tempOutClientCertValue = new tangible.OutObject();
// if (!getRegValue("RequireClientCertificate", tempOutClientCertValue))
// {
// clientCertValue = tempOutClientCertValue.argValue;
// throw new RuntimeException("'RequireClientCertificate' value couldn't be read from the registry.");
// }
// else
// {
// clientCertValue = tempOutClientCertValue.argValue;
// }
// sReqClientCertificate = clientCertValue == 1;
//
// tangible.OutObject tempOutSThumbprint = new tangible.OutObject();
// if (!getRegValue("CertificateThumbprint", tempOutSThumbprint))
// {
// sThumbprint = tempOutSThumbprint.argValue;
// throw new RuntimeException("'CertificateThumbprint' value couldn't be read from the registry.");
// }
// else
// {
// sThumbprint = tempOutSThumbprint.argValue;
// }
//
// tangible.OutObject tempOutSCertificateName = new tangible.OutObject();
// if (!getRegValue("CertificateName", tempOutSCertificateName) && sReqClientCertificate)
// {
// sCertificateName = tempOutSCertificateName.argValue;
// throw new RuntimeException("'CertificateName' value couldn't be read from the registry.");
// }
// else
// {
// sCertificateName = tempOutSCertificateName.argValue;
// }
}
//todo 5.0 sp3 SSL Communication
private static boolean getRegValue(String keyOfValue, tangible.RefObject value) {
// value.argValue = null;
// try
// {
// value.argValue = (TValue)RegHelper.GetRegValue(RegHelper.SSL_KEY, keyOfValue, 0);
// return true;
// }
// catch (java.lang.Exception e)
// {
// return false;
// }
return false;
}
//todo 5.0 sp3 SSL Communication
public static Object getSslProtocols() {
return null;
}
public static Object getEncryptionPolicy() {
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy