Solved

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

Posted on 2013-11-20
4
3,680 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
ID: 39664541
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 30

Assisted Solution

by:Rich Weissler
Rich Weissler earned 166 total points
ID: 39664562
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
ID: 39664770
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
ID: 39671265
Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Insert to Begin if data exists 2 33
tempdb log keep growing 7 34
SQL USE DATABASE VARIABLE 5 30
use of sqlCmd command through exec master..xp_cmdshell 7 16
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.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

831 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