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 />

Cert_ID<br />

Similar to AsymKey_ID, this returns an ID that relates to the name of a certificate name. The syntax is<br />

simple:<br />

Cert_ID(‘’)<br />

You must have permissions to the certificate in question to use this function.<br />

CertProperty<br />

Allows you to fetch various properties of a given certificate (as identified by the certificate’s ID). Valid<br />

properties include the start date, expiration date, certificate issuer’s name, serial number, security ID<br />

(the “SID,” which can also be returned as a string), and the subject of the certificate (who or what is<br />

being certified). The syntax looks like this:<br />

CertProperty ( ,<br />

'' | '' | '' | '' | '' | '' | '' )<br />

The data type returned will vary depending on the specific property you’re looking for (datetime,<br />

nvarchar, or varbinary as appropriate).<br />

DecryptByAsmKey<br />

As you can imagine by the name, this one decrypts a chunk of data utilizing an asymmetric key. It<br />

requires the key (by ID), the encrypted data (either as a literal string or a string coercible variable), and<br />

the password used to encrypt the asymmetric key (if one was used when the key was created). The<br />

syntax is straightforward enough:<br />

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

[, ‘’])<br />

Keep in mind that, if a password was utilized when creating the asymmetric key, the same password is<br />

going to be required to properly decrypt data utilizing that key.<br />

DecryptByCert<br />

600<br />

This is basically the same as DecryptByAsmKey, except that it expects a certificate rather than an asymmetric<br />

key. Like DecryptByAsmKey, this one decrypts a chunk of data utilizing a key. It requires the certificate<br />

(by ID), the encrypted data (either as a literal string or a string coercible variable), and the password used<br />

to further encrypt the data (if one was used). The syntax looks almost just like DecryptByAsymKey:<br />

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

[, ‘’])<br />

Again, any password utilized when encrypting the data will be needed to properly decrypt it.

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

Saved successfully!

Ooh no, something went wrong!