Solved

Is it possible to encrypt/decrypt TripleDES encryption from within T-SQL?

Posted on 2013-11-20
4
3,319 Views
Last Modified: 2013-11-23
Is it possible to encrypt/decrypt TripleDES encryption from within T-SQL?

I'm using SQL SERVER 2008 R2.

Could you please guide me how to achieve this? Thanks in advance.
0
Comment
Question by:Easwaran Paramasivam
4 Comments
 
LVL 42

Assisted Solution

by:EugeneZ
EugeneZ earned 167 total points
Comment Utility
yes, you can try

function ENCRYPTBYPASSPHRASE
Encrypt data with a passphrase, using the TRIPLE DES algorithm with a 128 key bit length.
http://technet.microsoft.com/en-us/library/ms190357(v=sql.105).aspx

and Decrypt with  DecryptByPassPhrase
Decrypts data that was encrypted with a passphrase.

http://technet.microsoft.com/en-us/library/ms188910(v=sql.105).aspx
0
 
LVL 29

Assisted Solution

by:Rich Weissler
Rich Weissler earned 166 total points
Comment Utility
Yes, TripleDES is one of the algorithms available in SQL 2008 R2.  There are two Triple DES algorithms available actually... 128 bit and 192 bit versions.  These instructions provide the commands needed to encrypt, then view the decrypted values.
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 167 total points
Comment Utility
If you want your encrypted data to be decrypted externally (or vice versa) then it is imperative that any keys are symmetric and if going to another database then there are fairly strict rules how to export that key.

There is also the choice of using external programs to encrypt / decrypt as exemplified by the code extract (down the bottom of) : http://forums.asp.net/t/1891297.aspx

If completely within SQL Server, then it does support TrippleDes very well and the above posts contain most of the relevant links.

A walkthrough example of triple des is presented by Pinal Dave (interestingly, has been an ative member of EE) : http://blog.sqlauthority.com/2009/04/28/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
Comment Utility
Thanks.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now