SQL 2012 :: Decrypting Encrypted Fields From Another Database

May 5, 2015

I am executing a stored procedure in one database (Database1) that pulls data from another database (Database2) that is the back end for a third party application. Some of the fields in that other database are now encrypted. I need to decrypt those fields but since the query is running in a database other than where the data lives (which is also where the symmetric key + cert lives), I am getting the following error: "Cannot find the symmetric key" Below is an example of what I am running in the stored procedure:

OPEN SYMMETRIC KEY [XXXXKey] DECRYPTION
BY CERTIFICATE [XXXX_CERT];
select CONVERT(Varchar(50), DECRYPTBYKEY( <ENCRYPTED FIELD> ))
FROM Database2.dbo.TABLE1
CLOSE SYMMETRIC KEY [XXXXKey];

What do I need to add to Database1 so the stored procedure can decrypt the data it pulls from Database2?

View 5 Replies


ADVERTISEMENT

Decrypting Encrypted Views/Sp/Functions.....?

Sep 19, 2006

Hi all,As all of you are aware you can Encrypt your Triggers/Stored Procedures/Views And Functionsin Sql Server with "WITH ENCRYPTION" clause.recently i came across a Stored procedure on the Net that could reverse and decrypt all Encrypted objects.i personally tested it and it really works.That's fine (of course for some body)Now i want to know is it a Known Bug for Sql Server 2000 and is there a permanent solution for Encrypting mentioned objects.Thanks in advance.Best Regards.

View 2 Replies View Related

Decrypting A Table Encrypted With EncryptByKey?

Jan 18, 2012

i have a ms sql base which contains tables encrypted with EncryptByKey, who knows how to make me a script do save the encrypted tables to clear text pm me in ym : hgfrfv or msn : [URL], i have all the keys used on encryption and all those stuff.

View 1 Replies View Related

Decrypting And Encrypted Stored Procedure

Sep 6, 2007

Hello,
In SQL 2000,
I have created a Stored Procedure as follows,




Code Snippet

CREATE PROCEDURE MyTest
WITH RECOMPILE, ENCRYPTION
AS
Select * From Customer
Then after this when i run this sp it giving me the perfect results wht i want, BUT when i want to change something in sp then for I am using the below line of code.




Code Snippet

sp_helptext mytest
But its displaying me that this sp is encrypted so you can't see the details and when i am trying to see trhe code of this sp from enterprise manager then also its not displaying me the details and giving me the same error,
So i want to ask that if there is a functionality of enrypting the sp code then is there any functionality for decrypting the Stored Procedure also,
or not,
If yes then wht it is and if NO then wht will be the alternative way for this,
?????

View 2 Replies View Related

Secure A Single SQL Server Database + Make Float Fields Encrypted

Mar 21, 2007

Hi all,

I am developing an application for a big office which uses SQL Server 2000.
Apart from my database, on that server, there are two databases by other companies.
The administrator also has access to server but the client only wants him to backup the database.

I have two questions:

1) First of all (if it is possible) I would like to protect my own database from the other companies.

I don't want them to:


see the data in the tables (around 20 tables)
make changes to the stored procedures (more than 100 stored procedures)
be able to backup the database

2) The client will save sensitive data to the database (mainly currency amounts, salaries etc) which he wants to keep hidden.
I am using float type for these fields and I would like to make the data encrypted. I could do it for nvarchar fields but changing these float to nvarchar would be time consuming.



Thanks for your patience reading this!

Would really appreciate some help on any of these

Nicolas

View 4 Replies View Related

SQL 2012 :: SSRS Using Encrypted Database?

Dec 10, 2014

I have an encrypted database in server A. The reporting service is running on server B. I deployed all my reports to Server B. When I run the reports, I got the following message:

The report server cannot decrypt the symmetric key that is used to access sensitive or encrypted data in a report server database.

I googled the problem, some said to backup the key, but when I opened the reporting service configuration tool to backup the encrypted, it said I needed to restore the key first. Some said I need to delete the key, but that defeated the purpose of an encrypted database.

View 0 Replies View Related

SQL 2012 :: Importing Encrypted PROCS Into Database Projects

Jan 19, 2015

I have inherited a database and looking to upgrade it from 2008 to 2014. I have imported the database into db projects but it has flagged warning s straight away because one of the previous contractors has created a bunch of stored procs with encryption.

View 0 Replies View Related

Searching For Encrypted Fields In Data Columns

Jul 20, 2005

I am new to database programming and was curious how others solve theproblem of storing encrypted in data in db table columns and thensubsequently searching for these records.The particular problem that I am facing is in dealing with (privacy)critical information like credit-card #s and SSNs or business criticalinformation like sales opportunity size or revenue in the database. Therequirement is that this data be stored encrypted (and not in theclear). Just limiting access to tables with this data isn't sufficient.Does any database provide native facilities to store specific columns asencrypted data ? The other option I have is to use something like RC4 toencrypt the data before storing them in the database.However, the subsequent problem is how do I search/sort on these columns? Its not a big deal if I have a few hundred records; I couldpotentially retrieve all the records, decrypt the specific fields andthen do in process searches/sorts. But what happens when I have (say) amillion records - I really don't want to suck in all that data and workon it but instead use the native db search/sort capabilities.Any suggestions and past experiences would be greatly appreciated.much thanks,~s

View 10 Replies View Related

Problem Restoring Database With Encrypted Columns To Different Database Or Server With Encrypted Columns.

Jan 23, 2006

I need to start encrypting several fields in a database and have been doing some testing with a test database first. I've run into problems when attempting to restore the database on either the same server (but different database) or to a separate server.

First, here's how i created the symmetric key and encrypted data in the original database:

create master key
encryption by password = 'testAppleA3';

create certificate test
with subject = 'test certificate',
EXPIRY_DATE = '1/1/2010';

create symmetric key sk_Test
with algorithm = triple_des
encryption by certificate test;

open symmetric key sk_Test decryption by certificate test;

insert into employees values (101,'Jane Doe',encryptbykey(key_guid('sk_Test'),'$200000'));
insert into employees values(102,'Bob Jones',encryptbykey(key_guid('sk_Test'),'$500000'));

select * from employees
--delete from employees
select id,name,cast(decryptbykey(salary) as varchar(10)) as salary from employees

close all symmetric keys

Next I backup up this test database and restore it to a new database on a different server (same issue if restore to different database but on same server).

Then if i attempt to open the key in the new database and decrypt:

open symmetric key sk_Test decryption by certificate test;

I get the error: An error occurred during decryption.

Ok, well not unexpected, so reading the forums, i try doing the below first in the new database:

ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY

Then I try opening the key again and get the error again:

An error occurred during decryption.

So then it occurs to me, maybe i need to drop and recreate it so i do

drop symmetric key sk_test

then

create symmetric key sk_Test
with algorithm = triple_des
encryption by certificate test;

and then try to open it.

Same error!

So then i decide, let's drop everything, the master key, the certificate and then symmetric key:

drop symmetric key sk_test
drop certificate test
drop master key

Then recreate the master key:

create master key
encryption by password = 'testAppleA3';

Restore the certificate from a backup i had made to a file:

CREATE CERTIFICATE test
FROM FILE = 'c:storedcertsencryptiontestcert'

Recreate the symmetric key again:

create symmetric key sk_Test
with algorithm = triple_des
encryption by certificate test;

And now open the key only to get the error:

Cannot decrypt or encrypt using the specified certificate, either because it has no private key or because the password provided for the private key is incorrect.

So what am I doing wrong here? In this scenario I would appear to have lost all access to decrypt the data in the database despite restoring from a backup which restored the symmetric key and certificate and i obviously know the password for the master key.

I also tried running the command

ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY

again but this does not resolve the issue.



Thx.

View 6 Replies View Related

Decrypting Password Of SysxLogins Table - SQL Database.

Dec 15, 2005

Hi,

    Is there any way of decrypting password value stored in sysxlogins table of SQL database?

Thx in Adv

 

 

View 4 Replies View Related

SQL 2012 :: Dumping Fields In A Single Column Of Database?

Apr 3, 2014

While working with a vast variety of support projects, i find a sql design where all the fields in a single form (say about 100 fields which are dump data as they are not related to any reports and searching criteria) are dumped in a sql database column in a XML format. See below an example

<?xml version="1.0" encoding="utf-8"?><FormBuilder><ClientID>0</ClientID><SiteID>0</SiteID><IncidentType></IncidentType><IncidentCategory></IncidentCategory><IncidentSubCategory></IncidentSubCategory><CreatedBy>2</CreatedBy><CreatedOn>Wednesday, April 02, 2014</CreatedOn><ModifiedOn /><ModifiedBy /><Section SectionID="ASD" SectionDisplayName="ASD" ColumnType="1" IsDeleted="0" SectionPosition="1"><SectionField FieldName="Bro" Section="ASD" ModuleID="0" Length="" PickData="" ChkData="" RadioData="" ListData="" FieldType="Text" Checked="false" ColumnType="1" IsDeleted="0" CoulmnOrder="0" FieldID="1" IsPrimary="" IsMandatory="" SystemMandatory="" RowPosition="1" FullRow="" /></Section></FormBuilder>

Just want to know the comments how far is this design feasible.....

What are the pros and cons of such a design...

Where we should use such type of db design where are the fields are dumped in a single column...

View 9 Replies View Related

DecryptByPassPhrase Not Decrypting Varchar Columns After Copying A Database

Jan 18, 2007

I have an encrypted column of data that is encrypted by a passphrase. The passphrase was encrypted by a symetric key in a key pair. The passphrase also is stored in a table. I can get the passphrase as needed to encrypt/decrypt the columns. I copied the production database to a new database for development. Subsequently I had to create a new symmetric/asymmetic key pair and recreated my passphrase with the new key pair. Now the passphrase will decrypt a text column but it will not decrypt two other columns which are of type varchar in the database. Here is an example:

DECLARE @pss varchar(30)
EXEC [dbo].[uspPassPhraseGet] @pss OUTPUT

SELECT DISTINCT contactid, uissueid, createdby, created_dt
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.title), 1, CONVERT(varbinary, 23))) as title
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.description), 1, CONVERT(varbinary, 23))) as description
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.shortdesc), 1, CONVERT(varbinary, 23))) as shortdesc,
closed_dt, confidential, statusid, due_dt, deleted_dt,deletedbyid, highrisk, dbo.tbl_msg_app_legislativeinquiry.designator, dbo.tbl_ref_sys_status.description AS statusdesc
FROM dbo.tbl_msg_app_legislativeinquiry INNER JOIN
dbo.tbl_ref_sys_status ON statusid = dbo.tbl_ref_sys_status.ustatusid INNER JOIN
dbo.tbl_gbl_lkp_security ON uissueid = dbo.tbl_gbl_lkp_security.msgid AND
dbo.tbl_msg_app_legislativeinquiry.designator = dbo.tbl_gbl_lkp_security.designator

Like I said I can execute the uspPassPhraseGet stored procedure and I get my passphrase. It will correctly decrypt the dbo.tbl_msg_app_legislativeinquiry.description field which is great but the other two fields will not decrypt. When i copied the database over the encrypted fields do not display the same on the new database. The old database shows a box character followed by a bunch of junk (as expected). The new copied table on the new database shows only a single box (not the same as the original). Is there a known bug with copying a table with varchar fields that are encrypted to a new database? I tried to run a test and got the same result. I also tried to convert the varchar columns to text to see if that solved the problem and it didn't. The description field however is a text type column and it reads exactly as the original. The problem I think is that the Copy Database didn't actually copy my data correctly. How can I get the original encrypted data from the production into my development. I also tried just dropping the table and reimporting the table but that didnt take either. Scratching my head on this one.

View 5 Replies View Related

SQL Server 2012 :: Getting All Fields From All Tables In Dynamics CRM 2011 Database?

Nov 5, 2014

Doing a data migration from one CRM to another and need to get a listing of all entities in current CRM, together with fields and field types. OK, I got the XRMToolBox which gives me that, but I'm hoping there is a sql tool out there that will do the same, plus give me a count on each field of the number of entries in that field in the database.

View 0 Replies View Related

SQL Server 2012 :: Encrypted Records In All Columns

Nov 6, 2014

I have idea on SMK, DMK and symmetric and asymmetric keys. I have also idea on TDE. But Is there any way to encrypt all the records of all the columns of a table in a database? actually I need to encrypt the database. Someone .... thinks that when someone will write select query he will get the encrypted records. As per as I am concerned it is not possible. I can encrypt the specific column using symmetric or other keys...

Is there any software or any tool which will provide encrypted records of database?

View 1 Replies View Related

SQL 2012 :: Delete Encrypted Key In SSRS But Now Report Cannot Connect To Datasource

Dec 10, 2014

I decided to delete the encryption key.After that when I go to the reporting page, the report cannot connect to the datasource.

An error has occurred during report processing. (rsProcessingAborted)

Cannot create a connection to data source 'xxxxx'. (rsErrorOpeningConnection)

For more information about this error navigate to the report server on the local server machine, or enable remote errors

What do I suppose to do?

View 0 Replies View Related

SQL 2012 :: Enabling SSL Encrypted Connections Without Using Force Encryption Option

Apr 1, 2015

I have a customer who is looking to encrypt their applications connection to the back-end SQL server. I've gotten a valid certificate for the server from a trusted CA, and it's installed on the server (shows up in Personal certificates in the Certificate MMC when selecting the computer) and I can choose it in the drop down on the certificates tab of the SQL Network protocols properties in Configuration Manager.

Now, my question: If I select the certificate but do NOT enable the "Force Encryption" option, the client will be able to request encryption on their end, and the connection will then be encrypted. If the client (other applications) do NOT request encryption, they will still be able to connect, but their connection will be un-encrypted. URL....

Lastly, I could've swore I had found some information indicating that some methods of establishing a connection to SQL can fail when Force Encryption is enabled, as the method doesn't support SSL encryption.

View 1 Replies View Related

SQL 2012 :: Encrypted Data In Project Manifest Failed To Load

Sep 8, 2015

An inherited SSIS (2012) solution displays the following messages when I try opening it in VS 2012:

"One or more projects in the solution were not loaded correctly."

Then another message displays

"The encrypted data in the project manifest failed to load. The project manifest is corrupted or the project was encrypted by another user."

View 8 Replies View Related

How To Know Encrypted Password From Database

Nov 20, 2014

I Forgot for my longtime used home expense update application password which has backend sql expressedition database.

i was used the application before 3 years, unfortunately i stopped updating my home expendature to the software.and now i require to login the application but i dont how reset the password in db, i have open database include tables of users profile. and password, but its encrypted.

View 1 Replies View Related

How To Store An Encrypted Password Into A Sql Database?

Apr 20, 2005

Hi everyone,
I am currently reading ASP.NET unleashed and practising few examples.  The following code converts a user's text into a symmetric encryption:
'nd: define keys
Const DESKey As String = "ABCDEFGH"
Const DESIV As String = "HGFEDCBA"
'nd: convert string to byte array
Function convert2ByteArray(ByVal strInput As String) As Byte()
Dim intCounter As Integer
Dim arrChar As Char()
arrChar = strInput.ToCharArray
Dim arrByte(arrChar.Length - 1) As Byte
For intCounter = 0 To arrByte.Length - 1
arrByte(intCounter) = Convert.ToByte(arrChar(intCounter))
Next
Return arrByte
End Function
 
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Dim arrDESKey As Byte()
Dim arrDESIV As Byte()
Dim arrInput As Byte()
Dim objFileStream As FileStream
Dim objDES As DESCryptoServiceProvider
Dim objEncryptor As ICryptoTransform
Dim objCryptoStream As CryptoStream
'convert string to bytes
arrDESKey = convert2ByteArray(DESKey)
arrDESIV = convert2ByteArray(DESIV)
arrInput = convert2ByteArray(txtInput.Text)
objDES = New DESCryptoServiceProvider
'pass keys
objEncryptor = objDES.CreateEncryptor(arrDESKey, arrDESIV)
'create to file to save password
objFileStream = New FileStream(MapPath("secret.txt"), FileMode.Create, FileAccess.Write)
'pass in file and keys
objCryptoStream = New CryptoStream(objFileStream, objEncryptor, CryptoStreamMode.Write)
'pass in text
objCryptoStream.Write(arrInput, 0, arrInput.Length)
objCryptoStream.Close()
lblDone.Text = "Done!"
End Sub
 
It works fine.  But, how to i save this encrypted password into a database field instead of a writing it to a file?  Also, could some please tell me how to paste code into this forum?  I tried <code></code> tags but it did not work.
Many thanks,
Kevin

View 9 Replies View Related

Encrypted Database Transfer Problem

Apr 4, 2006

Hi,

I have encrypted some columns of a table in a database. Following is the method which i applied for encryption.

I created a master key with a password and it is also encrypted by service master key.
Now i created a certificate without password, so it is only encrypted by master key of the database.
Now i created a symmetric key encrypted by the above certificate.
The data is encrypted by this symmetric key.

To decrypt data i use DecryptByKeyAutoCert.

On my server this encryption & decryption is working perfectly.

But when i take this database to another server, it is not working.

What is the solution for this, should i drop service master key to encrypt master key or is there any soln.

Thank you.

Pls give me soln. i am worried abt it.

Gaurav

View 4 Replies View Related

Backup Database With Encrypted Column Data

Jan 25, 2007

Hi,
I have database with encrypted column data in my customer server. Sometime, I might need to backup their database back to office for troubleshooting.

How could I backup/restore master key, symmetric and asymmetric key created for my database?

Thank you

View 6 Replies View Related

SQL 2012 :: TDE Encrypted Databases On 2 Different Server To Be Restored On Single Dev Server

Apr 29, 2015

have a Prod Server A having TDE enabled on 2 of those databases. I have a Prod Server B having TDE enabled on 3 of those databases. Now I have to create a single Dev server Server C for all the above 5 databases residing on the two servers. So how can I restore all the 5 database backup files on server C.

Does it mean that I need to copy the certificates and Keys from both the Prod server to this Dev Box and then restore the backup files. Once done, I can enable the encryption ON on those 5 database on Dev box or is there any different approach.Also how will tempdb behave in this scenario.

View 5 Replies View Related

SQL Server 2008 :: How To Check If The Database Itself Is Encrypted Or Only The Backups

Jul 9, 2015

I queried sys.databases in one of the sql server and found "is_encrypted" is "1" for four of the databases.

Does that mean that all those 4 DBs are encrypted ?

How to check if the database itself is encrypted or only the backups ?

Note :- I can see backups of key in a particular folder.

View 9 Replies View Related

SQL Security :: Enable Encrypted Connections To Database Engine?

Nov 2, 2015

The option:

SQL Server Configuration Manager>SQL Server Network Configuration>Protocol for SQL_xxx (right click)>Properties, we can see two Tabs:

Tab 1: Flags
Tab 2: Certificate

If I set the value of Hide Instance= Yes, does "Force Enctyption", need to be set YES as well? 

Or Force Enctyption has to be enabled in order to hide instance?

What is the recommend settings?

[URL]

View 3 Replies View Related

SQL Server Admin 2014 :: Cannot Decrypt Encrypted Columns From Database Backup On Local Machine

Jun 29, 2015

I've a SQL server 2014 running on one of our server. We're in the process of implementing security steps for our databases. I've encrypted a column in one of the table in the database on the server. The issue is when I restore the backup on my local SQL server and run a query to decrypt the column data it gives me null values. On the other end when I decrypt the column data on the main server it works fine. I found a thread on this forum which states to do the following when restoring the encrypted database on different server.

USE [master];
GO
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'StrongPassword';
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY;
GO

select File_Name
, CONVERT(nvarchar,DECRYPTBYKEY(File_Name))
from [test].[dbo].[Orders_Customer]

I tried doing above still no luck.

View 3 Replies View Related

Decrypting Data

Jun 14, 2006

Hi there,

I am having a table in Sql which has 2 columns which has data in encrypted format. It shows data in junk format (ascii format). But in frontend (tht is in software)it shows data in proper format. Can any one help me in decrypting data.

Thanks,

Regards,


mystical

View 16 Replies View Related

Decrypting The Password.....

Sep 8, 2007

I have a SQL Server Login and I forgot the password for it.
Is there any way I can decrypt the password. I don't want to
change the password.

Thanks
Venu

View 8 Replies View Related

Encrypting And Decrypting Data

Dec 22, 2006

CREATE TABLE TabEncr (
id int identity (1,1),
NonEncrField varchar(30),
EncrField varchar(30)
)

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'OurSecretPassword'
CREATE CERTIFICATE my_cert with subject = 'Some Certificate'
CREATE SYMMETRIC KEY my_key with algorithm = triple_des encryption by certificate my_cert

OPEN SYMMETRIC KEY my_key DECRYPTION BY CERTIFICATE my_cert
INSERT INTO TabEncr (NonEncrField,EncrField)
VALUES ('Some Plain Value',encryptbykey(key_guid('my_key'),'Some Plain Value'))
CLOSE SYMMETRIC KEY my_key

OPEN SYMMETRIC KEY my_key DECRYPTION BY CERTIFICATE my_cert
SELECT NonEncrField,CONVERT(VARCHAR(30),DecryptByKey(EncrField))
FROM dbo.TabEncr
CLOSE SYMMETRIC KEY my_key

What is the problem with this code. It works fine , inserting the value encrypted but when i try to decrypt ,it returns a null value. What is missing. I also tried with symmetric key encryption with asymmetric key. Result is same, returns NULL value. I am using SQL 2005

Happy Coding...

View 15 Replies View Related

Problems With Decrypting Columns

Mar 31, 2006

Hi!

I want to encrypt a whole column in my table and I do this with this SQL code:

OPEN symmetric key Sym_Key DECRYPTION BY certificate My_Cert
GO

UPDATE [My_demo].[dbo].[My-DemoList]
SET [Test_crypt] = encryptByKey(Key_GUID('Sym_Key'),[Test])
GO

CLOSE all symmetric keys

GO

And this seems ok but when I want to decrypt it with the view I have created it seems that I get a "rubbish" character between each "real" character.

So my questions is: What am I doing wrong?

Because if I do an insert like this

OPEN symmetric key Sym_Key DECRYPTION BY certificate My_Cert
GO

INSERT INTO [My-DemoList] (Test_crypt) VALUES(encryptByKey(Key_GUID('Sym_Key'),'1234567'))

GO

CLOSE all symmetric keys

And then use my view to look at the decrypted value that I put in its ok.

Many thanks in advance!

View 4 Replies View Related

Decrypting Returns A NULL Value

Apr 26, 2007













I find it weird when decrypting a column from a baked up database and restoring it to another database. Here's the scenario:

Server1 has Database1.
Database1 has Table1 with two columns encyrpted -- Card Number and SS Number
Encryption and decryption in this Database1 is perfectly fine. Records are encrypted and can be decrypted too.
Now, I tried to backup this Database1 and restore it to another server with SQL 2005 instance called Server2. Of course the columns Card and SS Numbers were encrypted. I tried decrypting the columns using the same command to decrypt in Database1, however, it returns a NULL value


Here's exactly what I did to create the encyprtion and decryption keys on the restored database:
-- Create the master key encryption
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'myMasterPassword'

-- Create a symetric key
CREATE SYMMETRIC KEY myKey WITH ALGORITHM = DES
ENCRYPTION BY Password='myPassword';
Go

-- Create Card Certificate
CREATE CERTIFICATE myCert WITH SUBJECT = 'My Certificate on this Server';
GO

-- Change symmetric key
OPEN SYMMETRIC KEY myKey DECRYPTION BY PASSWORD = 'myPassword';

-- I then verified if the key is opened
SELECT * FROM sys.openkeys




If I create a new database, say Database2 from that Server2, create table, master key, certificate, and symmetric key. Encrpytion and decryption on Database2 will work!




Any suggestions gurus? I tried all searches and help for almost 2 weeks regarding this issue but nobody could resolve this.

Thanks in advance!



faiga16



3 Posts

View 9 Replies View Related

Decrypting Column In Transformation

Oct 2, 2007

I have a OLE DB Source that has a varbinary column of encrypted data. The sorce table is on a hosted SQL Server database where I cannot install a asymetric key. The SSIS package is running on a local SQL Server box that does have the asymetric key installed and working. Can you recommend the best way to transform this column is SSIS using a connection to the local SQL Server box that has the installed public key?

select @encryptedstuff = 0xA19B9F77E5319283311F325D6D29265721A8451148DCD33FA37DF34737C29690BEE35F99972AD7D40F31E8EFE81A30A9B830ABCD1B6BE386462071D67198CE6E52E15FAD84CA62AA35F847948F40B3F8CF4F50D5F2A14D0CCD9FF990F3C1701784F0A8771B93D329144528455937511EF2691BB42A0D4505AC8F9296BF6700801ECE05B102F0CC6DAF204F4EA4C8317AAEDDEC7D83BCD78BA1718C9E55C840AEA280D8BC9CC58D8E05AAE0AE5AC4B7DA0CE7D5DF1DDCAEEA1FB7431ACDF20BBDB2F29ECD744FDEE3D688920E56BEF5508D8224D0DE6AAE8FF944E389D376138885FC4300AFD281C8CC677CDA1762B56D8D1363C7878EAA7A65FC10B8AE168E75

SELECT CONVERT(nvarchar(50),DecryptByAsymKey(AsymKey_ID('rsakey'), REVERSE(@encryptedstuff), N'P4ssw0rd'))



Each row of the OLE DB Source contains a varbinary column with the ecrypted data. I need to to transform that one column and end up with a new record set that contains all of the columns from the OLE DB Source plus a new decrypted column.

Thanks,

Steve

View 4 Replies View Related

Decrypting Provided Data

May 2, 2007

I have following problem. I would like to provide to my STP encrypted data and decrypt them inside it. To decrypt the data I'd like to use DecryptByKey. Encryption should be made on the Win32/.NET client.



Unfortunately I cannot find the way to make the data understable between the both worlds. First how to assign the same key on the both side? Do I get the same key from




Code Snippet

create symmetric key MyKey with

algorithm=triple_des,

key_source='abrakadabra'

encryption by password='aaa'



and from




Code Snippet

string Key = "abrakadabra";

byte[] bKey = Encoding.ASCII.GetBytes(Key);

byte[] salt = new byte[8];



RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider();

rnd.GetBytes(salt);

PasswordDeriveBytes pdb = new PasswordDeriveBytes(bKey, salt);



TripleDESCryptoServiceProvider prov = new TripleDESCryptoServiceProvider();

prov.GenerateIV();

prov.Key = pdb.CryptDeriveKey("TripleDES", "SHA1", 168, prov.IV);

???

I have read somewhere that create symmetric key calls CryptDeriveKey, but I'm not sure.



The next point is the format of the output data. I have noted, that the output from EncryptByKey is 16 bytes longer (after stripping key guid and fixed 0x01000000) than the one from Win32/.NET application. I assume, that it can lie in the inserting of IV as the first block, but should not IV be only 64 bit long in the DES family of algorithms?



Neverthless I have not magaged to perform encrypted communication such way between SQL Server 2005 and client application. Is it possible at all?







View 1 Replies View Related

Encryping - Decrypting Stored Procedures

Oct 19, 2004

Hi all...

Im wondering how do you encrypt and decrypt a stored procedure within sql server 2000 ?

i want to be able to encrypt data been inserted / updated using triple des algorithm and then on select / read - decrypt it.

Does anyone know a solution / stored procedure on how to do this? any ideas.

Thanks

Paul..

Im also wondering if there is a away of doing this on the code side without using stored procedures (asp.net c#) i have been able to encrypt and decrpt to a string but unable to do it through the datagrid object (dataset) or a datareader..

Any tips / help would be helpful

Thanks..

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved