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 Encryption-- Return Search ResultsSELECTbn.Borrower_LName,bn.Borrower_FName,bn.Borrower_MName,bn.Borrower_SuffixFROMdbo.Borrower_Identification biINNER JOIN dbo.Borrower_Name bnON bi.Borrower_ID = bn.Borrower_IDWHEREbi.Identification_Value_HT =HashBytes('SHA1',@Salt +@Identification_Value);END TRYBEGIN CATCH-- Returns the error informationSELECTERROR_NUMBER() AS ErrorNumber,ERROR_SEVERITY() AS ErrorSeverity,ERROR_STATE() AS ErrorState,ERROR_MESSAGE() AS ErrorMessage;END CATCHGOListing 7-13: Creating the Search_Borrower_Identification storedprocedure.The plain text identification value that is passed in is salted and hashed, usingthe "SHA1" algorithm, and then placed in the WHERE clause of the statement tobe compared with the hash value that is stored in the table.Setting and Verifying Permissions to the StoredProceduresOnce the stored procedures have been created, we need to grant the appropriatepermissions to them (see Listing 7-14). With the HomeLending database wewill be operating on the assumption that the Sensitive_high database rolewill have access to the information that will be inserted and updated to theBorrower_Identification table.The ability to search the data that is in the Borrower_Identificationtable will be granted to the Sensitive_high and Sensitive_medium167

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

Saved successfully!

Ooh no, something went wrong!