Showing posts with label bit. Show all posts
Showing posts with label bit. Show all posts

Thursday, March 22, 2012

Encryption ?

Does SQL Server use any type of encryption internally ?
eg. when I take backup of a database is it encrypted if yes then how many bit encryption does it use ?

When a client makes a connection to SQL 2000 server, does it use encryption ? if yes then how many bit encryption is it ?

Any help would be appreciated.

ThanksHi ,

sql server allows for encryption of data for both 16-bit and 32-bit clients with the encryption option of the Multi-Procotol Network Library.

to enable encryption you can select the "Enable multi-protocol encryption" checkbox in the sql server setup program.

hope this clarifies your doubt.

thanks

Sunday, March 11, 2012

EncryptByKey Function always returning null

When I use EncryptByKey function to encrypt text using AES 128 bit key, I get always null result. this is how I do the encryption:

ALTER PROCEDURE [dbo].[ProcMyProc](@.ClearText nvarchar(50))
AS
BEGIN

OPEN SYMMETRIC KEY MyKey DECRYPTION BY PASSWORD= 'MY_Password_128';

Declare @.Temp varbinary(8000);

Set @.Temp =EncryptByKey(Key_GUID('MyKey'),@.ClearText);

close symmetric key MyKey;

select @.Temp as temp;
END

The result I get for this procedure is null. Is there something wrong with this code?

Hey Muhammad,

I tried out your code and it seems to work for me. Can you try executing your script outside of the proc? You can add in "select * from sys.openkeys" after your open statement just to check to see if the key was actually opened.

Sung

|||

Also, if this still doesn't work, can you let us know what OS version you are using? Is it XP, 2000, or 2003?

Thanks
Laurentiu

|||I found the cause of the problem. I was misspelling the name of the key when passing it to the Key_GUID() function. but shouldn't this give an error saying there's no key with this name instead of just returning null?|||

Hi Muhammad,

The way our built-ins work is that they return null instead of returning an error. I don't remember why exactly this is the case, but I think it has to do with backwards compatibility and parsing logic of the built-ins.

Sung