17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Appendix A: System Functions<br />

EncryptByKey<br />

This one not only expects a symmetric key (instead of the other types of key), but it also expects that key<br />

to already be “open” (using the OPEN SYMMETRIC KEY command) and a GUID to be available to reference<br />

that key by. Other than that, it is fairly similar in use, with the data to be encrypted (either as a literal<br />

string or a string coercible variable) fed in as a parameter and, in this case, a hash key optionally accepted<br />

as an authenticator):<br />

EncryptByKey({, ‘’|},<br />

[, ‘’|])<br />

Note that if you provide an add authenticator value (in the form of an int), that value must be supplied<br />

when the string is decrypted, and you must also supply a hash value (which again will be needed at<br />

decryption time).<br />

EncryptByPassPhrase<br />

This one encrypts data not by using a formal key, but by a passphrase. Other than accepting a passphrase<br />

parameter instead of assuming an open key, EncryptByPassPhrase works almost exactly like<br />

EncryptByKey:<br />

EncryptByPassPhrase({‘’|},<br />

{‘’|},<br />

[, ‘’|])<br />

As with EncryptByKey, if you provide an add authenticator value (in the form of an int), that value<br />

must be supplied when the string is decrypted, and you must also supply a hash value.<br />

Key_GUID<br />

Fetches the GUID for a given symmetric key in the current database:<br />

Key_ID<br />

Key_GUID(‘’)<br />

Fetches the GUID for a given symmetric key in the current database:<br />

Key_ID(‘’)<br />

SignByAsymKey<br />

602<br />

Adds an asymmetric key signature to a given plain text value:<br />

SignByAsymKey(, [, ‘’])

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

Saved successfully!

Ooh no, something went wrong!