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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix A – Views and Functions ReferenceThis function will return the decrypted value as a varbinary value, whichwill require the use of the CONVERT function to present the decrypted value asreadable text.NOTE:To use symmetric keys in the encryption and decryption process they mustfirst be opened. Once the key is opened, using the OPEN SYMMETRIC KEYcommand, it remains open until it is explicitly closed, using the CLOSESYMMETRIC KEY command, or the session is terminated.USE HomeLending;GOOPEN SYMMETRIC KEY MySymKeyDECRYPT BY PASSWORD = N'MyStr0ngP@ssword2009';GOSELECTConvert(nvarchar(max),DecryptByKey(Identification_Value))FROMdbo.Borrower_IdentificationWHEREBorrower_ID = 1;GOCLOSE SYMMETRIC KEY MySymKey;GOListing A-16: Syntax of DecryptByKey.DecryptByPassphraseThis function is used to decrypt data that has been encrypted with a key that isgenerated from a passphrase. The user performing decryption will require theknowledge of the passphrase that was used during the encryption process.This function will return the decrypted value as a varbinary value, whichwill require the use of the CONVERT function to present the decrypted value asreadable text.USE HomeLending;GO215

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

Saved successfully!

Ooh no, something went wrong!