Encrypted values are different although the source is the same
From: CB (craig.bryden_at_derivco.com)
Date: 11/29/05
- Next message: David Gugick: "Re: Encrypted values are different although the source is the same"
- Previous message: Andrew J. Kelly: "Re: SQL database view"
- Next in thread: David Gugick: "Re: Encrypted values are different although the source is the same"
- Reply: David Gugick: "Re: Encrypted values are different although the source is the same"
- Reply: Remus Rusanu [MSFT]: "Re: Encrypted values are different although the source is the same"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 29 Nov 2005 11:47:16 +0200
Hi
I am in the process of evaluating the SQL 2005 data encryption. I have
noticed something very strange and am hoping that someone would be able to
clear it up for me.
I have a table that holds credit card numbers. It is possible that there
will be two or more rows with the same credit card number.
I have created my master key:
create master key encryption by password =
'***********************************************'
GO
I have created my certificate:
create certificate cert_sk_admin with subject = 'Certificate for accessing
symmetric keys';
GO
I have created my symmetric key:
create symmetric key sk_CreditCard with algorithm = aes_128 encryption by
certificate cert_sk_admin;
GO
I have added a new column to the credit card table (lets call it CCNO_Enc.
The existing column is CCNO).
I then update the new column:
UPDATE CREDITCARD
SET CCNO_Enc = EncryptByKey(Key_GUID('sk_CreditCard'), CCNO)
GO
The Problem:
If I now query this table (select CCNO, CCNO_Enc FROM CREDITCARD WHERE CCNO
= '123456789'), I get two records back (there are two rows with this CCNO).
The problem is that the encrypted value of the two rows is different??? How
can this be if the source value is the same. Our problem with this is that
searching on an encrypted column is very slow(when performing the
decryption). We would like to encrypt the search criteria and use that to do
a direct comparison on the encrypted field (without decrypting it in the
where clause)
The Questions:
1. Why are the encrypted values different?
2. Can this be changed?
Thanks
Craig
- Next message: David Gugick: "Re: Encrypted values are different although the source is the same"
- Previous message: Andrew J. Kelly: "Re: SQL database view"
- Next in thread: David Gugick: "Re: Encrypted values are different although the source is the same"
- Reply: David Gugick: "Re: Encrypted values are different although the source is the same"
- Reply: Remus Rusanu [MSFT]: "Re: Encrypted values are different although the source is the same"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|