summaryrefslogtreecommitdiffstats
path: root/base/util
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-03-18 03:33:10 +0100
committerEndi S. Dewata <edewata@redhat.com>2017-03-18 03:47:22 +0100
commit2b9f9b7ef9e936dc5dc7ecc7bcc4c2fd8236dd1f (patch)
treef216887ccd09f33d6179e1a0582e526ddec81c7a /base/util
parentd8e38f26f8b333d339cdf46ae8237e1754bc078a (diff)
downloadpki-2b9f9b7ef9e936dc5dc7ecc7bcc4c2fd8236dd1f.tar.gz
pki-2b9f9b7ef9e936dc5dc7ecc7bcc4c2fd8236dd1f.tar.xz
pki-2b9f9b7ef9e936dc5dc7ecc7bcc4c2fd8236dd1f.zip
Cleaned up CryptoUtil.setClientCiphers(String).
The CryptoUtil.setClientCiphers(String) has been reformatted to simplify future refactoring.
Diffstat (limited to 'base/util')
-rw-r--r--base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java41
1 files changed, 17 insertions, 24 deletions
diff --git a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
index f8b087120..fccda69e4 100644
--- a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
+++ b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
@@ -928,32 +928,25 @@ public class CryptoUtil {
}
+ public static void setClientCiphers(String list) throws SocketException {
- // if clientOverrideCiphers is provided in config, use it
- public static void setClientCiphers(String clientOverrideCiphers)
- throws SocketException {
- if (clientOverrideCiphers != null) {
- String strCiphers[] = clientOverrideCiphers.split(",");
- if (strCiphers.length != 0) {
- unsetSSLCiphers();
- int cipherid;
- for (int i=0; i< strCiphers.length; i++) {
- Object mapValue;
-
- mapValue = cipherMap.get(strCiphers[i]);
- if (mapValue == null) {
- cipherid = 0;
- } else {
- cipherid = (Integer) mapValue;
- }
- if (cipherid != 0) {
- SSLSocket.setCipherPreferenceDefault(cipherid, true);
- }
- }
- }
- return;
- } else { //use default
+ if (list == null) {
+ // use default
setClientCiphers();
+ return;
+ }
+
+ String ciphers[] = list.split(",");
+ if (ciphers.length == 0) return;
+
+ unsetSSLCiphers();
+
+ for (String cipher : ciphers) {
+
+ Integer cipherID = cipherMap.get(cipher);
+ if (cipherID == null) continue;
+
+ SSLSocket.setCipherPreferenceDefault(cipherID, true);
}
}