>From c57875a84e61d6e0a71da5b74a3c2ce0e13132a6 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Sat, 21 Jan 2017 01:12:39 +0100
Subject: [PATCH] Replaced internal token full name literals.

The internal token full name literals have been replaced with
CryptoUtil.INTERNAL_TOKEN_FULL_NAME.

https://fedorahosted.org/pki/ticket/2556
---
 base/ca/src/com/netscape/ca/SigningUnit.java       |  2 +-
 .../cms/servlet/test/ConfigurationTest.java        | 66 +++++++++++-----------
 .../src/com/netscape/cmstools/KRATool.java         |  2 +-
 base/ocsp/src/com/netscape/ocsp/SigningUnit.java   |  2 +-
 .../cms/publish/publishers/OCSPPublisher.java      |  7 ++-
 .../cms/servlet/admin/KRAConnectorProcessor.java   |  3 +-
 .../cms/servlet/cert/scep/CRSEnrollment.java       |  4 +-
 .../com/netscape/cms/servlet/csadmin/CertUtil.java |  2 +-
 .../cms/servlet/csadmin/ConfigurationUtils.java    | 32 +++++------
 .../cms/servlet/csadmin/GetSubsystemCert.java      |  2 +-
 .../cms/servlet/csadmin/UpdateOCSPConfig.java      |  3 +-
 .../com/netscape/cms/servlet/tks/TokenServlet.java |  3 +-
 .../dogtagpki/server/rest/SystemConfigService.java |  2 +-
 .../src/com/netscape/cmscore/apps/CMSEngine.java   |  2 +-
 .../src/org/dogtagpki/server/tps/TPSSubsystem.java |  3 +-
 .../server/tps/processor/TPSProcessor.java         |  5 +-
 16 files changed, 73 insertions(+), 67 deletions(-)

diff --git a/base/ca/src/com/netscape/ca/SigningUnit.java b/base/ca/src/com/netscape/ca/SigningUnit.java
index e711f491e40ac3c69d6059bc498a141cdee9943e..d97bd8bc6d4b5b130e29270b300b79f0744c6520 100644
--- a/base/ca/src/com/netscape/ca/SigningUnit.java
+++ b/base/ca/src/com/netscape/ca/SigningUnit.java
@@ -152,7 +152,7 @@ public final class SigningUnit implements ISigningUnit {
 
             tokenname = config.getString(PROP_TOKEN_NAME);
             if (tokenname.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_NAME) ||
-                    tokenname.equalsIgnoreCase("Internal Key Storage Token")) {
+                    tokenname.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
                 mToken = mManager.getInternalKeyStorageToken();
                 setNewNickName(mNickname);
             } else {
diff --git a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
index 0416853da58666c4067751a711a61f5d2f7db23f..f77ca4d430d05332fce7d6bdd879f19b641a6f0d 100644
--- a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
+++ b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java
@@ -290,7 +290,7 @@ public class ConfigurationTest {
         cert1.setNickname("signingCert testca");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=CA Signing Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         systemCerts.add(cert1);
 
@@ -302,7 +302,7 @@ public class ConfigurationTest {
         cert2.setNickname("ocspSigningCert testca");
         cert2.setSigningAlgorithm("SHA256withRSA");
         cert2.setSubjectDN("CN= CA OCSP Signing Certificate");
-        cert2.setToken("Internal Key Storage Token");
+        cert2.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert2);
 
         SystemCertData cert3 = new SystemCertData();
@@ -312,7 +312,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testca");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -322,7 +322,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testca");
         cert4.setSubjectDN("CN=CA Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -333,7 +333,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testca");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=CA Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -394,7 +394,7 @@ public class ConfigurationTest {
         cert1.setNickname("signingCert testsubca");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=SubCA Signing Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         systemCerts.add(cert1);
 
@@ -406,7 +406,7 @@ public class ConfigurationTest {
         cert2.setNickname("ocspSigningCert testsubca");
         cert2.setSigningAlgorithm("SHA256withRSA");
         cert2.setSubjectDN("CN= SubCA OCSP Signing Certificate");
-        cert2.setToken("Internal Key Storage Token");
+        cert2.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert2);
 
         SystemCertData cert3 = new SystemCertData();
@@ -416,7 +416,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testsubca");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -426,7 +426,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testsubca");
         cert4.setSubjectDN("CN=SubCA Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -437,7 +437,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testsubca");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=SubCA Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -496,7 +496,7 @@ public class ConfigurationTest {
         cert1.setNickname("signingCert testexternalca");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=External CA Signing Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         systemCerts.add(cert1);
 
@@ -508,7 +508,7 @@ public class ConfigurationTest {
         cert2.setNickname("ocspSigningCert testexternalca");
         cert2.setSigningAlgorithm("SHA256withRSA");
         cert2.setSubjectDN("CN= External CA OCSP Signing Certificate");
-        cert2.setToken("Internal Key Storage Token");
+        cert2.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert2);
 
         SystemCertData cert3 = new SystemCertData();
@@ -518,7 +518,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testexternalca");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -528,7 +528,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testexternalca");
         cert4.setSubjectDN("CN=External CA Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -539,7 +539,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testexternalca");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=SubCA Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -599,7 +599,7 @@ public class ConfigurationTest {
         cert1.setNickname("signingCert testexternalca");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=External CA Signing Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         String extCert = "";
         BufferedReader in = new BufferedReader(new FileReader(extCertFile));
@@ -627,7 +627,7 @@ public class ConfigurationTest {
         cert2.setNickname("ocspSigningCert testexternalca");
         cert2.setSigningAlgorithm("SHA256withRSA");
         cert2.setSubjectDN("CN= External CA OCSP Signing Certificate");
-        cert2.setToken("Internal Key Storage Token");
+        cert2.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert2);
 
         SystemCertData cert3 = new SystemCertData();
@@ -637,7 +637,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testexternalca");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -647,7 +647,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testexternalca");
         cert4.setSubjectDN("CN=External CA Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -658,7 +658,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testexternalca");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=SubCA Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -705,7 +705,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testca");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         data.setSystemCerts(systemCerts);
@@ -765,7 +765,7 @@ public class ConfigurationTest {
         cert1.setNickname("transportCert testkra");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=KRA Transport Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         systemCerts.add(cert1);
 
@@ -777,7 +777,7 @@ public class ConfigurationTest {
         cert2.setNickname("storageCert testkra");
         cert2.setSigningAlgorithm("SHA256withRSA");
         cert2.setSubjectDN("CN= KRA Storage Certificate");
-        cert2.setToken("Internal Key Storage Token");
+        cert2.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert2);
 
         SystemCertData cert3 = new SystemCertData();
@@ -787,7 +787,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testkra");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -797,7 +797,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testkra");
         cert4.setSubjectDN("CN=KRA Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -808,7 +808,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testkra");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=KRA Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -868,7 +868,7 @@ public class ConfigurationTest {
         cert1.setNickname("ocspSigningCert testocsp");
         cert1.setSigningAlgorithm("SHA256withRSA");
         cert1.setSubjectDN("CN=OCSP Signing Certificate");
-        cert1.setToken("Internal Key Storage Token");
+        cert1.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
 
         systemCerts.add(cert1);
 
@@ -879,7 +879,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testocsp");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -889,7 +889,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testocsp");
         cert4.setSubjectDN("CN=OCSP Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -900,7 +900,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testocsp");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=OCSP Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
@@ -960,7 +960,7 @@ public class ConfigurationTest {
         cert3.setKeyType("rsa");
         cert3.setNickname("sslServerCert testtks");
         cert3.setSubjectDN("CN=" + host);
-        cert3.setToken("Internal Key Storage Token");
+        cert3.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert3);
 
         SystemCertData cert4 = new SystemCertData();
@@ -970,7 +970,7 @@ public class ConfigurationTest {
         cert4.setKeyType("rsa");
         cert4.setNickname("subsystemCert testtks");
         cert4.setSubjectDN("CN=TKS Subsystem Certificate");
-        cert4.setToken("Internal Key Storage Token");
+        cert4.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert4);
 
         SystemCertData cert5 = new SystemCertData();
@@ -981,7 +981,7 @@ public class ConfigurationTest {
         cert5.setNickname("auditSigningCert testtks");
         cert5.setSigningAlgorithm("SHA256withRSA");
         cert5.setSubjectDN("CN=TKS Audit Signing Certificate");
-        cert5.setToken("Internal Key Storage Token");
+        cert5.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME);
         systemCerts.add(cert5);
 
         data.setSystemCerts(systemCerts);
diff --git a/base/java-tools/src/com/netscape/cmstools/KRATool.java b/base/java-tools/src/com/netscape/cmstools/KRATool.java
index 63afe877643b0c68533e7bfcd92a0bf78e25bb99..c89d488e2ee0f596ae43d1a7d7d68a88415d99ad 100644
--- a/base/java-tools/src/com/netscape/cmstools/KRATool.java
+++ b/base/java-tools/src/com/netscape/cmstools/KRATool.java
@@ -597,7 +597,7 @@ public class KRATool {
     private static final String SOURCE_STORAGE_TOKEN_NAME_EXAMPLE = SOURCE_STORAGE_TOKEN_NAME
                                       + " "
                                       + TIC
-                                      + "Internal Key Storage Token"
+                                      + CryptoUtil.INTERNAL_TOKEN_FULL_NAME
                                       + TIC;
 
     private static final String SOURCE_STORAGE_CERT_NICKNAME = "-source_storage_certificate_nickname";
diff --git a/base/ocsp/src/com/netscape/ocsp/SigningUnit.java b/base/ocsp/src/com/netscape/ocsp/SigningUnit.java
index 78f18b697428ccbaa52c4c2562de309209a46e71..2cf22e3d91c7d93a9c3d0074563c1d4a3388b333 100644
--- a/base/ocsp/src/com/netscape/ocsp/SigningUnit.java
+++ b/base/ocsp/src/com/netscape/ocsp/SigningUnit.java
@@ -139,7 +139,7 @@ public final class SigningUnit implements ISigningUnit {
 
             tokenname = config.getString(PROP_TOKEN_NAME);
             if (tokenname.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_NAME) ||
-                    tokenname.equalsIgnoreCase("Internal Key Storage Token")) {
+                    tokenname.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
                 mToken = mManager.getInternalKeyStorageToken();
             } else {
                 mToken = mManager.getTokenByName(tokenname);
diff --git a/base/server/cms/src/com/netscape/cms/publish/publishers/OCSPPublisher.java b/base/server/cms/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
index f3e9d3c6f619fa8807816c7db50e00f20e9e2c51..bfdcc7530d8ac3dc8da28f032dbcb69ce52c3ed0 100644
--- a/base/server/cms/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
+++ b/base/server/cms/src/com/netscape/cms/publish/publishers/OCSPPublisher.java
@@ -30,8 +30,6 @@ import java.util.Locale;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
-import netscape.ldap.LDAPConnection;
-
 import com.netscape.certsrv.apps.CMS;
 import com.netscape.certsrv.base.EBaseException;
 import com.netscape.certsrv.base.IConfigStore;
@@ -39,9 +37,12 @@ import com.netscape.certsrv.base.IExtendedPluginInfo;
 import com.netscape.certsrv.ldap.ELdapException;
 import com.netscape.certsrv.logging.ILogger;
 import com.netscape.certsrv.publish.ILdapPublisher;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 import com.netscape.cmsutil.http.HttpRequest;
 import com.netscape.cmsutil.http.JssSSLSocketFactory;
 
+import netscape.ldap.LDAPConnection;
+
 /**
  * This publisher writes certificate and CRL into
  * a directory.
@@ -144,7 +145,7 @@ public class OCSPPublisher implements ILdapPublisher, IExtendedPluginInfo {
         try {
             nickname = config.getString("ca.subsystem.nickname", "");
             String tokenname = config.getString("ca.subsystem.tokenname", "");
-            if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token"))
+            if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 nickname = tokenname + ":" + nickname;
         } catch (Exception e) {
         }
diff --git a/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorProcessor.java b/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorProcessor.java
index ae1dae5c14258c38263d3c526871d4ad8b4c51f8..92067c7c333ccf3b975484f86ba88b9af141ae3b 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorProcessor.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorProcessor.java
@@ -34,6 +34,7 @@ import com.netscape.certsrv.connector.IConnector;
 import com.netscape.certsrv.system.ConnectorNotFoundException;
 import com.netscape.certsrv.system.KRAConnectorInfo;
 import com.netscape.cms.servlet.processors.CAProcessor;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 
 /**
  * @author Ade Lee
@@ -193,7 +194,7 @@ public class KRAConnectorProcessor extends CAProcessor {
 
         String nickname = cs.getString("ca.subsystem.nickname", "");
         String tokenname = cs.getString("ca.subsystem.tokenname", "");
-        if (!tokenname.equals("Internal Key Storage Token"))
+        if (!tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
             nickname = tokenname + ":" + nickname;
         cs.putString(PREFIX + ".nickName", nickname);
         cs.commit(true);
diff --git a/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java b/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
index 5861e45583dc481ba6580bb340fe44845a64ba63..27840bdc6464a7f852ceb9a0a48cf113fddcd833 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/cert/scep/CRSEnrollment.java
@@ -246,7 +246,7 @@ public class CRSEnrollment extends HttpServlet {
                     mUseCA = false;
                 }
                 if (!(mTokenName.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_NAME) ||
-                        mTokenName.equalsIgnoreCase("Internal Key Storage Token") || mTokenName.length() == 0)) {
+                        mTokenName.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) || mTokenName.length() == 0)) {
                     int i = mNickname.indexOf(':');
                     if (!((i > -1) && (mTokenName.length() == i) && (mNickname.startsWith(mTokenName)))) {
                         mNickname = mTokenName + ":" + mNickname;
@@ -1965,7 +1965,7 @@ public class CRSEnrollment extends HttpServlet {
                 internalToken = cm.getInternalCryptoToken();
                 DESkg = internalToken.getKeyGenerator(kga);
                 if (mTokenName.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_NAME) ||
-                        mTokenName.equalsIgnoreCase("Internal Key Storage Token") ||
+                        mTokenName.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) ||
                         mTokenName.length() == 0) {
                     keyStorageToken = cm.getInternalKeyStorageToken();
                     internalKeyStorageToken = keyStorageToken;
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/CertUtil.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/CertUtil.java
index ed762def6f293dc2b0fa328938fab40373a442a7..5acedbc0d457e24c1eda32f2702db9a73da2c9ba 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/CertUtil.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/CertUtil.java
@@ -764,7 +764,7 @@ public class CertUtil {
 
         String fullnickname = nickname;
 
-        if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token")) {
+        if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
             fullnickname = tokenname + ":" + nickname;
         }
 
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
index d018e9c1b373f218eca9b02ebd8d402c32ae8497..c7014a2a4e58e8f208a30e47e711520d1fde5a9c 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
@@ -997,7 +997,7 @@ public class ConfigurationUtils {
 
             String name1 = "preop.master." + tag + ".nickname";
             String nickname = cs.getString(name1, "");
-            if (!tokenname.equals("Internal Key Storage Token") &&
+            if (!tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) &&
                     !tokenname.equals("internal"))
                 nickname = tokenname + ":" + nickname;
 
@@ -2342,7 +2342,7 @@ public class ConfigurationUtils {
         CryptoManager cm = CryptoManager.getInstance();
 
         if (token != null) {
-            if (!token.equals("internal") && !token.equals("Internal Key Storage Token"))
+            if (!token.equals("internal") && !token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 nickname = token + ":" + nickname;
         }
 
@@ -2815,7 +2815,7 @@ public class ConfigurationUtils {
         String cstype = config.getString("cs.type", null);
         cstype = cstype.toLowerCase();
         if (cstype.equals("kra")) {
-            if (!token.equals("Internal Key Storage Token")) {
+            if (!token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
                 if (certTag.equals("storage")) {
                     config.putString(subsystem + ".storageUnit.hardware", token);
                     config.putString(subsystem + ".storageUnit.nickName", token + ":" + nickname);
@@ -2834,7 +2834,7 @@ public class ConfigurationUtils {
         String serverCertNickname = nickname;
         String path = CMS.getConfigStore().getString("instanceRoot", "");
         if (certTag.equals("sslserver")) {
-            if (!token.equals("Internal Key Storage Token")) {
+            if (!token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
                 serverCertNickname = token + ":" + nickname;
             }
             PrintStream ps = new PrintStream(path + "/conf/serverCertNick.conf", "UTF-8");
@@ -2845,7 +2845,7 @@ public class ConfigurationUtils {
         config.putString(subsystem + "." + certTag + ".nickname", nickname);
         config.putString(subsystem + "." + certTag + ".tokenname", token);
         if (certTag.equals("audit_signing")) {
-            if (!token.equals("Internal Key Storage Token") && !token.equals("")) {
+            if (!token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) && !token.equals("")) {
                 config.putString("log.instance.SignedAudit.signedAuditCertNickname",
                         token + ":" + nickname);
             } else {
@@ -2855,7 +2855,7 @@ public class ConfigurationUtils {
         }
 
         // for system certs verification
-        if (!token.equals("Internal Key Storage Token") && !token.equals("")) {
+        if (!token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) && !token.equals("")) {
             config.putString(subsystem + ".cert." + certTag + ".nickname",
                     token + ":" + nickname);
         } else {
@@ -2929,7 +2929,7 @@ public class ConfigurationUtils {
         cstype = cstype.toLowerCase();
         if (cstype.equals("kra")) {
             String token = config.getString("preop.module.token");
-            if (!token.equals("Internal Key Storage Token")) {
+            if (!token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
                 CMS.debug("ConfigurationUtils: updating configuration for KRA clone with hardware token");
                 String subsystem = config.getString(PCERT_PREFIX + "storage.subsystem");
                 String storageNickname = getNickname(config, "storage");
@@ -2947,7 +2947,7 @@ public class ConfigurationUtils {
         // audit signing cert
         String audit_nn = config.getString(cstype + ".audit_signing" + ".nickname", "");
         String audit_tk = config.getString(cstype + ".audit_signing" + ".tokenname", "");
-        if (!audit_tk.equals("Internal Key Storage Token") && !audit_tk.equals("")) {
+        if (!audit_tk.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) && !audit_tk.equals("")) {
             config.putString("log.instance.SignedAudit.signedAuditCertNickname",
                     audit_tk + ":" + audit_nn);
         } else {
@@ -3332,7 +3332,7 @@ public class ConfigurationUtils {
 
         if (certTag.equals("signing") && subsystem.equals("ca")) {
             String NickName = nickname;
-            if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token"))
+            if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 NickName = tokenname + ":" + nickname;
 
             CMS.debug("handleCerts(): set trust on CA signing cert " + NickName);
@@ -3349,7 +3349,7 @@ public class ConfigurationUtils {
         IConfigStore cs = CMS.getConfigStore();
         String nickname = cs.getString("preop.cert." + tag + ".nickname", "");
         String tokenname = cs.getString("preop.module.token", "");
-        if (!tokenname.equals("Internal Key Storage Token"))
+        if (!tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
             nickname = tokenname + ":" + nickname;
 
         CryptoManager cm = CryptoManager.getInstance();
@@ -3375,7 +3375,7 @@ public class ConfigurationUtils {
 
         String fullnickname = nickname;
         boolean hardware = false;
-        if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token")) {
+        if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
             hardware = true;
             fullnickname = tokenname + ":" + nickname;
         }
@@ -3427,7 +3427,7 @@ public class ConfigurationUtils {
             NoSuchTokenException, TokenException {
         IConfigStore cs = CMS.getConfigStore();
         String nickname = cs.getString("preop.cert.sslserver.nickname");
-        deleteCert("Internal Key Storage Token", nickname);
+        deleteCert(CryptoUtil.INTERNAL_TOKEN_FULL_NAME, nickname);
     }
 
     public static void deleteCert(String tokenname, String nickname) throws NotInitializedException,
@@ -3438,7 +3438,7 @@ public class ConfigurationUtils {
         CryptoStore store = tok.getCryptoStore();
         String fullnickname = nickname;
         if (!tokenname.equals("") &&
-                !tokenname.equals("Internal Key Storage Token") &&
+                !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) &&
                 !tokenname.equals("internal"))
             fullnickname = tokenname + ":" + nickname;
 
@@ -3485,7 +3485,7 @@ public class ConfigurationUtils {
             String nickname = cs.getString("preop.cert." + t + ".nickname");
             String modname = cs.getString("preop.module.token");
 
-            if (!modname.equals("Internal Key Storage Token"))
+            if (!modname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 nickname = modname + ":" + nickname;
 
             util.loadCertFromNSS(pkcs12, nickname, true, false);
@@ -3998,7 +3998,7 @@ public class ConfigurationUtils {
             String tokenname = cs.getString("preop.module.token", "");
 
             if (!tokenname.equals("") &&
-                    !tokenname.equals("Internal Key Storage Token") &&
+                    !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) &&
                     !tokenname.equals("internal")) {
                 nickname = tokenname + ":" + nickname;
             }
@@ -4574,7 +4574,7 @@ public class ConfigurationUtils {
         String nickname = cs.getString("preop.cert.subsystem.nickname", "");
         String tokenname = cs.getString("preop.module.token", "");
 
-        if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token")
+        if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)
                 && !tokenname.equals("")) {
             nickname = tokenname + ":" + nickname;
         }
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java
index b894971b174b0634601d9fcfc50e88ef6a7511ff..aa5c830a36faa472bfdedc32b5a9595f04d58527 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/GetSubsystemCert.java
@@ -70,7 +70,7 @@ public class GetSubsystemCert extends CMSServlet {
         try {
             nickname = cs.getString("ca.subsystem.nickname", "");
             String tokenname = cs.getString("ca.subsystem.tokenname", "");
-            if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token"))
+            if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 nickname = tokenname + ":" + nickname;
         } catch (Exception e) {
         }
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/UpdateOCSPConfig.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/UpdateOCSPConfig.java
index c34df8b9c9bd1da9b839483e42c9ebb66c99e09c..12bb3d41be96eb238f85c6b4f82885fdd53c7b34 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/UpdateOCSPConfig.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/UpdateOCSPConfig.java
@@ -38,6 +38,7 @@ import com.netscape.cms.servlet.base.CMSServlet;
 import com.netscape.cms.servlet.base.UserInfo;
 import com.netscape.cms.servlet.common.CMSRequest;
 import com.netscape.cms.servlet.common.ICMSTemplateFiller;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 import com.netscape.cmsutil.xml.XMLObject;
 
 public class UpdateOCSPConfig extends CMSServlet {
@@ -107,7 +108,7 @@ public class UpdateOCSPConfig extends CMSServlet {
         try {
             nickname = cs.getString("ca.subsystem.nickname", "");
             String tokenname = cs.getString("ca.subsystem.tokenname", "");
-            if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token"))
+            if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
                 nickname = tokenname + ":" + nickname;
         } catch (Exception e) {
         }
diff --git a/base/server/cms/src/com/netscape/cms/servlet/tks/TokenServlet.java b/base/server/cms/src/com/netscape/cms/servlet/tks/TokenServlet.java
index 9c143fd310a0f911f0346ac25dee17c867167928..a2a797534587d586641d5985cf3c6b4555b9168d 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/tks/TokenServlet.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/tks/TokenServlet.java
@@ -49,6 +49,7 @@ import com.netscape.certsrv.base.SessionContext;
 import com.netscape.certsrv.logging.ILogger;
 import com.netscape.cms.servlet.base.CMSServlet;
 import com.netscape.cms.servlet.common.CMSRequest;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 import com.netscape.symkey.SessionKey;
 
 /**
@@ -2471,7 +2472,7 @@ public class TokenServlet extends CMSServlet {
         }
 
         // We know for now that shared secret is on this token
-        String tokenName = "Internal Key Storage Token";
+        String tokenName = CryptoUtil.INTERNAL_TOKEN_FULL_NAME;
         PK11SymKey sharedSecret = SessionKey.GetSymKeyByName(tokenName, sharedSecretName);
 
         CMS.debug("TokenServlet.getSharedSecret: SymKey returns: " + sharedSecret);
diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
index 963df4d05d6d568036f292361c1048eadf1be8b4..a0c1b785e42548cc511145000c304193b694417b 100644
--- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
+++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
@@ -588,7 +588,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
     }
 
     private void updateConfiguration(ConfigurationRequest data, SystemCertData cdata, String tag) {
-        if (cdata.getToken().equals("Internal Key Storage Token")) {
+        if (cdata.getToken().equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) {
             cs.putString(csSubsystem + ".cert." + tag + ".nickname", cdata.getNickname());
         } else {
             cs.putString(csSubsystem + ".cert." + tag + ".nickname", data.getToken() +
diff --git a/base/server/cmscore/src/com/netscape/cmscore/apps/CMSEngine.java b/base/server/cmscore/src/com/netscape/cmscore/apps/CMSEngine.java
index 9001e9ea68d466330269760af06249a6fb545653..bfb44aba0472b8758a22c7aa415acb4255ffa8f7 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/apps/CMSEngine.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/apps/CMSEngine.java
@@ -1449,7 +1449,7 @@ public class CMSEngine implements ICMSEngine {
         String newName = null;
 
         if (tokenName.equals(CryptoUtil.INTERNAL_TOKEN_NAME) ||
-                tokenName.equalsIgnoreCase("Internal Key Storage Token"))
+                tokenName.equalsIgnoreCase(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
             newName = nickName;
         else {
             if (tokenName.equals("") && nickName.equals(""))
diff --git a/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java b/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java
index ea765da02ebeb608c372ed3c0d3832aa4284cf8c..013e9984d66f5924e8ede98210fddf7ba64a85f2 100644
--- a/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java
+++ b/base/tps/src/org/dogtagpki/server/tps/TPSSubsystem.java
@@ -55,6 +55,7 @@ import com.netscape.certsrv.request.IRequestQueue;
 import com.netscape.certsrv.tps.token.TokenStatus;
 import com.netscape.cmscore.base.FileConfigStore;
 import com.netscape.cmscore.dbs.DBSubsystem;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 
 /**
  * @author Endi S. Dewata <edewata@redhat.com>
@@ -366,7 +367,7 @@ public class TPSSubsystem implements IAuthority, ISubsystem {
         IConfigStore cs = CMS.getConfigStore();
         String nickname = cs.getString("tps.subsystem.nickname", "");
         String tokenname = cs.getString("tps.subsystem.tokenname", "");
-        if (!tokenname.equals("internal") && !tokenname.equals("Internal Key Storage Token"))
+        if (!tokenname.equals("internal") && !tokenname.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME))
             nickname = tokenname + ":" + nickname;
 
         CryptoManager cm = CryptoManager.getInstance();
diff --git a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
index 9530dd5441e5a5c55f7d122baaf1c1d85061767d..d8f9c4f1835b50c8a855a2b6ce681450575bcc4a 100644
--- a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
+++ b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java
@@ -96,6 +96,7 @@ import com.netscape.certsrv.common.Constants;
 import com.netscape.certsrv.logging.ILogger;
 import com.netscape.certsrv.tps.token.TokenStatus;
 import com.netscape.cms.servlet.tks.SecureChannelProtocol;
+import com.netscape.cmsutil.crypto.CryptoUtil;
 import com.netscape.symkey.SessionKey;
 
 import netscape.security.x509.RevocationReason;
@@ -681,7 +682,7 @@ public class TPSProcessor {
 
         SecureChannelProtocol protocol = new SecureChannelProtocol();
 
-        String tokenName = "Internal Key Storage Token";
+        String tokenName = CryptoUtil.INTERNAL_TOKEN_FULL_NAME;
 
         CryptoManager cm = null;
         CryptoToken token = null;
@@ -2880,7 +2881,7 @@ public class TPSProcessor {
         }
 
         // We know for now that shared secret is on this token
-        String tokenName = "Internal Key Storage Token";
+        String tokenName = CryptoUtil.INTERNAL_TOKEN_FULL_NAME;
         PK11SymKey sharedSecret = SessionKey.GetSymKeyByName(tokenName, sharedSecretName);
 
         CMS.debug("TPSProcessor.getSharedSecret: SymKey returns: " + sharedSecret);
-- 
2.5.5

