Solved

FIPS Compliance

Posted on 2013-01-11
2
605 Views
Last Modified: 2013-01-14
We need to encrypt sensitive data in our database for our internal Web Application written in VS 2010 C# and using a MS SQL Server 2005 database.

I created a DLL to handle the encryption function.  Here is the code:

        public string Encrypt(string toEncrypt, bool useHashing, string key)
        {
            // If string is null or whitespace, return toEncrypt
            if (String.IsNullOrEmpty(toEncrypt) || String.IsNullOrWhiteSpace(toEncrypt) || toEncrypt.Equals(DBNull.Value))
                return toEncrypt;

            // Strip blanks from end of string
            toEncrypt = toEncrypt.Trim();
     
            byte[] keyArray;
            byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);

            System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
            if (String.IsNullOrEmpty(key))
                // Get the key from config file
                key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
            //System.Windows.Forms.MessageBox.Show(key);
            if (useHashing)
            {
                MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
                keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
                hashmd5.Clear();
            }
            else
                keyArray = UTF8Encoding.UTF8.GetBytes(key);

            TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
            tdes.Key = keyArray;
            tdes.Mode = CipherMode.ECB;
            tdes.Padding = PaddingMode.PKCS7;

            ICryptoTransform cTransform = tdes.CreateEncryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
            tdes.Clear();
            return Convert.ToBase64String(resultArray, 0, resultArray.Length);
        }

Open in new window


I integrated the DLL into my web application and it works fine on our testing server.  However when I deployed to our Production server I get the following error:

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.  I researched the error and tried the following to resolve it but have not been successful.

1. Verified "Local Security Setting System Cryptography. Use FIPs compliant algorithms for encryption, hashing, and signing" policy is disabled on our Production server.

2. Verified the registry key for fipsalgorithmpolicy is set to 0.

3. Added <machinekey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="3DES" decryption="3DES" /> to web.config file under <system.web>.  Restarted IIS.

4. Added <enforceFIPSPolicy enable="false" /> in web.config under <configuration><runtime>.

We are trying to see if the FIPs setting is at the GPO or Domain Controller level and overriding my settings but haven't heard back from our server department yet.

Is there something else I can do or how can I make my algorithm FIPS compliant?
0
Comment
Question by:dyarosh
2 Comments
 
LVL 61

Accepted Solution

by:
btan earned 500 total points
Comment Utility
i dont suggest that you disable FIPS esp this is production server. It will be worst off since MD5 is  weaker algorithm compared to SHA1 for hashing  - use SHA1CryptoServiceProvider Class instead

http://stackoverflow.com/questions/13018808/asp-net-this-implementation-is-not-part-of-the-windows-platform-fips-validated-c

Since you already used TripleDESCryptoServiceProvider that is fine and better will be for  AesCryptoServiceProvider (.net3.5 above) Class. But try the SHA1 first :)

This is one good link
http://blog.aggregatedintelligence.com/2007/10/fips-validated-cryptographic-algorithms.html
0
 

Author Closing Comment

by:dyarosh
Comment Utility
This solved the problem of being able to use Hashing but I have another question that I will be posting.  Thanks for your help.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
You cannot be 100% sure that you can protect your organization against crypto ransomware but you can lower down the risk and impact of the infection.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now