diff --git a/base/ca/shared/conf/CS.cfg b/base/ca/shared/conf/CS.cfg
index b873e040ccb..c1321c86b21 100644
--- a/base/ca/shared/conf/CS.cfg
+++ b/base/ca/shared/conf/CS.cfg
@@ -177,6 +177,7 @@ auths.impl.UserPwdDirAuth.class=com.netscape.cms.authentication.UserPwdDirAuthen
auths.impl.TokenAuth.class=com.netscape.cms.authentication.TokenAuthentication
auths.impl.FlatFileAuth.class=com.netscape.cms.authentication.FlatFileAuth
auths.impl.SessionAuthentication.class=com.netscape.cms.authentication.SessionAuthentication
+auths.impl.SharedToken.class=com.netscape.cms.authentication.SharedSecret
auths.instance.TokenAuth.pluginName=TokenAuth
auths.instance.AgentCertAuth.agentGroup=Certificate Manager Agents
auths.instance.AgentCertAuth.pluginName=AgentCertAuth
@@ -735,8 +736,6 @@ ca.publish.rule.instance.LdapXCertRule.predicate=
ca.publish.rule.instance.LdapXCertRule.publisher=LdapCrossCertPairPublisher
ca.publish.rule.instance.LdapXCertRule.type=xcert
cmc.popLinkWitnessRequired=false
-#cmc.revokeCert.sharedSecret.class=com.netscape.cms.authentication.SharedSecret
-#cmc.sharedSecret.class=com.netscape.cms.authentication.SharedSecret
cmc.token=internal
cms.passwordlist=internaldb,replicationdb
cms.password.ignore.publishing.failure=true
diff --git a/base/common/src/com/netscape/certsrv/authentication/ISharedToken.java b/base/common/src/com/netscape/certsrv/authentication/ISharedToken.java
index 84b02440416..b33ae7b76bd 100644
--- a/base/common/src/com/netscape/certsrv/authentication/ISharedToken.java
+++ b/base/common/src/com/netscape/certsrv/authentication/ISharedToken.java
@@ -16,6 +16,7 @@
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.authentication;
+import com.netscape.certsrv.base.EBaseException;
import java.math.BigInteger;
@@ -27,9 +28,12 @@
public interface ISharedToken {
// support for id_cmc_identification
- public String getSharedToken(String identification);
+ public String getSharedToken(String identification)
+ throws EBaseException;
- public String getSharedToken(PKIData cmcData);
+ public String getSharedToken(PKIData cmcData)
+ throws EBaseException;
- public String getSharedToken(BigInteger serialnum);
+ public String getSharedToken(BigInteger serialnum)
+ throws EBaseException;
}
diff --git a/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecord.java b/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecord.java
index 65db57e70d9..d0d0748b944 100644
--- a/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecord.java
+++ b/base/common/src/com/netscape/certsrv/dbs/certdb/ICertRecord.java
@@ -55,6 +55,8 @@ public interface ICertRecord extends IDBObj {
public static final String META_CRMF_REQID = "crmfReqId";
public static final String META_CHALLENGE_PHRASE = "challengePhrase";
public static final String META_PROFILE_ID = "profileId";
+ // for supporting CMC shared-secret based revocation
+ public static final String META_REV_SHRTOK = "revShrTok";
public final static String STATUS_VALID = "VALID";
public final static String STATUS_INVALID = "INVALID";
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCSharedToken.java b/base/java-tools/src/com/netscape/cmstools/CMCSharedToken.java
new file mode 100644
index 00000000000..4705eee435f
--- /dev/null
+++ b/base/java-tools/src/com/netscape/cmstools/CMCSharedToken.java
@@ -0,0 +1,320 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2017 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.cmstools;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
+import org.apache.commons.io.FileUtils;
+import org.mozilla.jss.CryptoManager;
+import org.mozilla.jss.crypto.CryptoToken;
+import org.mozilla.jss.crypto.EncryptionAlgorithm;
+import org.mozilla.jss.crypto.IVParameterSpec;
+import org.mozilla.jss.crypto.KeyGenAlgorithm;
+import org.mozilla.jss.crypto.KeyWrapAlgorithm;
+import org.mozilla.jss.crypto.ObjectNotFoundException;
+import org.mozilla.jss.crypto.PrivateKey;
+import org.mozilla.jss.crypto.SymmetricKey;
+import org.mozilla.jss.crypto.X509Certificate;
+
+import com.netscape.cmsutil.crypto.CryptoUtil;
+import com.netscape.cmsutil.util.Cert;
+import com.netscape.cmsutil.util.Utils;
+
+import netscape.security.util.DerInputStream;
+import netscape.security.util.DerOutputStream;
+import netscape.security.util.DerValue;
+
+/**
+ * A command-line utility used to take a passphrase as an input and
+ * generate an encrypted entry for ldap entry
+ *
+ *
+ * IMPORTANT: The issuance protection certificate file needs to be created to
+ * contain the certificate in its PEM format.
+ *
+ *
+ * @author cfu
+ */
+public class CMCSharedToken {
+ public boolean verbose = false;
+
+ public static Options createOptions() {
+
+ Options options = new Options();
+
+ Option option = new Option("d", true, "Security database location");
+ option.setArgName("database");
+ options.addOption(option);
+
+ option = new Option("h", true, "Security token name");
+ option.setArgName("token");
+ options.addOption(option);
+
+ option = new Option("o", true, "Output file to store base-64 secret data");
+ option.setArgName("output");
+ options.addOption(option);
+
+ option = new Option("p", true, "passphrase");
+ option.setArgName("passphrase");
+ options.addOption(option);
+
+ option = new Option("b", true, "PEM issuance protection certificate");
+ option.setArgName("issuance protection cert");
+ options.addOption(option);
+
+ option = new Option("n", true, "Issuance Protection certificate nickname");
+ option.setArgName("issuance protection cert nickname");
+ options.addOption(option);
+
+ options.addOption("v", "verbose", false, "Run in verbose mode.");
+ options.addOption(null, "help", false, "Show help message.");
+
+ return options;
+ }
+
+ public static void printHelp() {
+
+ System.out.println("Usage: CMCSharedToken [OPTIONS]");
+ System.out.println(" If the issuance protection cert was previously imported into the");
+ System.out.println(" nss database, then -n can be used instead of -b ");
+ System.out.println();
+ System.out.println("Options:");
+ System.out.println(" -d Security database location (default: current directory)");
+ System.out.println(" -h Security token name (default: internal)");
+ System.out.println(" -p CMC enrollment passphrase (put in \"\" if containing spaces)");
+ System.out.println(" Use either -b OR -n below");
+ System.out.println(" -b PEM issuance protection certificate");
+ System.out.println(" -n issuance protection certificate nickname");
+ System.out.println("To store the base-64 secret data, the following options are required:");
+ System.out.println(" -o