February 18, 2023 at 5:51 pm
I have a T-SQL script which encrypts the SSN using the ENCRYPTBYPASSPHRASE function with a pass phrase. ENCRYPTBYPASSPHRASE('Key', CAST(e.ssn AS nvarchar(100)))
The ENCRYPT and DECRYPT function works fine when performed on the same server, which is SQL 2019.
But, when I perform the ENCRYPT on server "A" . Then write the result set to server "B" and try to DECRYPT the column. It returns NULL?
SELECT Convert(nvarchar(100),DECRYPTBYPASSPHRASE('Key',SSNEncrypt)) AS SSN
February 19, 2023 at 6:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
February 21, 2023 at 3:42 pm
Can't reproduce it
DECLARE @source varbinary(4000)=0x0200000022695FA76ADC377F399412C032EFA78DA0E0DA5F2A7E20D880D6465AC72AD152;
SELECT CONVERT(NVARCHAR(100), DECRYPTBYPASSPHRASE('Key',@source)) AS SSN
Results in ABC on different collations
February 22, 2023 at 8:04 am
This was removed by the editor as SPAM
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply