question

SSMS_Newbie avatar image
SSMS_Newbie asked

How to Decrypt Using SQL Server 2016

I've got two databases - Oracle 11g and SQL Server 2016. The Oracle database has a table that is being decrypted using the following: DBMS_CRYPTO.DECRYPT ( src => UTL_I18N.STRING_TO_RAW (in_text, 'AL32UTF8'), typ => encryption_type, key => key_bytes_raw ) Where 'encryption_type is defined as: encryption_type PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_PKCS5; I am trying to convert this Oracle code so that it can be used in SQL Server 2016. Any thoughts on how to convert the code? I am a newbie to SQL Server and have been looking through the Microsoft site for tips, but am confused. Thanks!
encryption
5 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@SSMS_Newbie Should not the SQL Server table be decrypted the way it is already encrypted? If you want the encryption + decryption then it is easier but a different case alltogether. May be I am missing something?
0 Likes 0 ·
How do I do the encryption and decryption?
0 Likes 0 ·
@SSMS_Newbie So IIUC, you want to follow the same code for encryption and decryption as it is in ORACLE? In that case, I should wait for an Oracle expert to chime in. Just curious though, what if it is not possible to follow Oracle's encryption exactly? Will you be OK with any other technique of SQL Server then? Just asking these questions to clarify the requirements.
0 Likes 0 ·
Yes, I will be OK with an SQL Server technique. Thanks!
0 Likes 0 ·
Please have a look at the following. Also look into the details of links available at the end for better understanding. Moreover, comments section is quite important, as the MS documentation is not that good :) [Encrypt a Column of Data][1] [ENCRYPTBYKEY][2] [1]: https://docs.microsoft.com/en-us/sql/relational-databases/security/encryption/encrypt-a-column-of-data [2]: https://docs.microsoft.com/en-us/sql/t-sql/functions/encryptbykey-transact-sql
0 Likes 0 ·

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.