K2 Issue – Symmetric Keys Missing After Database Move and Upgrade

When creating a new K2 environment, it is often easiest to backup and move the K2 database(s) across to the new environment’s SQL server and reconfiguring the database(s) to contain the new environment information rather than to redeploy all existing processes, SmartObjects and solutions into the new environment (which can often cause quite a headache with differing SmartObject GUIDs etc).

What can happen sometimes, however, is the symmetric keys used by K2 for single sign-on and other authentication purposes, go missing. Recently this happened to me when upgrading from 0807 to 4.5. This was reported in the configuration analysis after the upgrade with multiple errors similar to the following:

“Symmetric key for the <Insert Database Name here> database has not been detected.”

In order to recreate the symmetric keys for the databases where they are missing and resolve the issue, first stop the K2 server service, make a backup of all K2 database(s), and run the following scripts on each database listed in error in the configuration analysis:

DROP SYMMETRIC KEY SCSSOKey
DROP CERTIFICATE SCHostServerCert
DROP MASTER KEY

If the above commands fail, don’t fret, this just means that the symmetric keys indeed do not exist, which is why we will then run the following commands to replace them:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘*CONTACT K2 SUPPORT FOR KEY*’

CREATE CERTIFICATE SCHostServerCert 
WITH SUBJECT = 'Host Server Certificate', START_DATE = '01/01/2007', EXPIRY_DATE = '01/01/2017' 
CREATE SYMMETRIC KEY SCSSOKey WITH ALGORITHM = TRIPLE_DES 
ENCRYPTION BY CERTIFICATE SCHostServerCert 

The above set of commands should succeed, resulting in the required symmetric keys being recreated for the databases.

Once you have run these commands successfully, re-analyse the nodes in the configuration analysis and you should see that they no longer display in error.

1 thought on “K2 Issue – Symmetric Keys Missing After Database Move and Upgrade

Leave a comment