17.07.2015 Views

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7 – One-Way EncryptionGOdbo.Borrower_Identification;-- Grant Select PermissionsGRANT SELECT ON dbo.vwBorrower_IdentificationTO Sensitive_high, Sensitive_medium;GOListing 7-10: Recreating the vwBorrower_Identification view.Creating the Stored ProceduresHaving earlier restricted direct access to the Borrower_Identificationtable, the ability to insert, update and search records that are contained withinthe Borrower_Identification table will be achieved through storedprocedures.The stored procedure that will be used to perform the UPDATE methods will becalled Update_Borrower_Identification and the script to create it isshown in Listing 7-11. The plain text value of the borrower's identificationvalue as well as the unique identifying value for the record that is beingupdated in the Borrower_Identification table is passed into this storedprocedure as parameters. This stored procedure then performs the necessarysalting and hashing, using the GetHashSalt function and the Hashbytesmethod, as described earlier.USE HomeLending;GOCREATE PROCEDURE dbo.Update_Borrower_Identification@Borrower_Identification_ID bigint,@Identification_Value varchar(250)ASBEGIN TRY-- Get SaltDECLARE @Salt varchar(7)SET @Salt = dbo.GetHashSalt('L01');-- Performs the update of the recordUPDATE dbo.Borrower_IdentificationSET Identification_Value_H =HashBytes('SHA1',@Salt +@Identification_Value),Identification_Value_HT =HashBytes('SHA1',@Salt +Right(@Identification_Value,4))164

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!