programming4us
programming4us
DATABASE

SQL Server : Implementing One-Way Encryption (part 1) - Populate the Hash Columns, Verify the Implementation, Drop the Unencrypted Column

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

Populate the Hash Columns

The next step will be to populate our new Identification_Value_H and Identification_Value_HT columns with the hash values of the Identification_Value column.

Listing 4 shows the script to do this. It uses the GetHashSalt user defined function to salt the values in the Identification_Value column and then updates the data in our the newly-created hash columns in our Borrower_Identification table so that they are salted and hashed, in the case of the Identification_Value_H column, and salted, truncated and hashed, in the case of the Identification_Value_HT column.

Listing 4. Salting and hashing the Identification_Value column.

Verify the Implementation

To verify that our hash values were successfully generated, we can execute SELECT statements that filter, based upon our newly generated columns, as shown in Listing 5.

Listing 5. Testing the one-way encryption.

The results of these queries, indicating successful implementation of one-way encryption, would appear as follows:

Identification_Value
-------------------------------------------------------
555-20-7151
(1 row(s) affected)
Identification_Value
-------------------------------------------------------
555-20-7151
(1 row(s) affected)

Drop the Unencrypted Column

Having successfully encrypted the contents of our Identification_Value column, captured it into the Identification_Value_H and Identification_Value_HT columns, and verified that they are working correctly; we can remove the Identification_Value column that contains the plain text values of our sensitive data.

This is accomplished through the use of the ALTERTABLE method and the DROP COLUMN argument, as shown in Listing 6.

Listing 6. Dropping the plain-text column.

Please note that the plain text values contained in this column will be permanently lost with its removal. This is definitely an action in which we will want to take pause. Perform the DROPCOLUMN command only if you are certain that you will no longer need to reference its contents. At the beginning of this process we performed a database backup which will provide us a means of recovery if needed. If the plain text values are archived to another location it too will need to be protected.

Other  
  •  Sql Server 2012 : Hierarchical Data and the Relational Database - Hierarchical Table Indexing Strategies
  •  Sql Server 2012 : Hierarchical Data and the Relational Database - Populating the Hierarchy (part 3) - The GetAncestor Method
  •  Sql Server 2012 : Hierarchical Data and the Relational Database - Populating the Hierarchy (part 2) - The ToString Method
  •  Sql Server 2012 : Hierarchical Data and the Relational Database - Populating the Hierarchy (part 1)
  •  Sql Server 2012 : Hierarchical Data and the Relational Database - The hierarchyid Data Type, Creating a Hierarchical Table
  •  Personal Cloud WD My Cloud EX2 Review
  •  Synology DS213j Your Own Cloud Entertainment Starts Here
  •  ADATA Premier Pro SP920 256GB
  •  Netgear ReadyNAS 314 Enterprise Network Storage
  •  Budget Portable Hard Drivers Review
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us