EntityFrameworkCore.DataEncryption
EntityFrameworkCore.DataEncryption copied to clipboard
is there any way to open encrypted data with SQL command?
encryption data:e/nPxzHfbQLJrL+JjUvM5A==
this._encryptionKey = Convert.FromBase64String("xtlG3ujQ70glBQ4jYu7q2g==");
this._encryptionIV = Convert.FromBase64String("OFHWnm08YigWgT6keFFY0g==");
_provider = new AesProvider(this._encryptionKey, this._encryptionIV);
I tried many methods, I thought I could open it in SQL because AES is a standard structure, but I couldn't. Can you send a sample code block?
DATABASE:MSSQL
I encountered the same issue as you did. I am using a MySQL database, and I also want to decrypt data using SQL, but I have been trying for a long time without success.
@frtlec @Brawns mysql script
`SET @keyBase = 'xxx'; SET @encrypted_data = 'xxx';
SET @@SESSION.block_encryption_mode = 'aes-256-cbc';
-- Convert the keyBase to binary SET @keyBaseBinary = CONVERT(@keyBase USING utf8);
-- Convert the binary keyBase to Base64 SET @key = TO_BASE64(@keyBaseBinary);
-- Decode the keyBase from Base64 encoding SET @binary_encrypted_data = FROM_BASE64(@encrypted_data);
-- Extract the first 16 bytes from the decoded data as the IV SET @iv = SUBSTRING(@binary_encrypted_data, 1, 16);
-- Remove the IV from the binary data SET @data_without_iv = SUBSTRING(@binary_encrypted_data, 17);
-- Decrypt the data using AES_DECRYPT in MySQL SELECT CAST(AES_DECRYPT(@data_without_iv, @key, @iv) AS CHAR) AS decrypted_data;`
@frtlec @Brawns mysql script
`SET @keybase = 'xxx'; SET @encrypted_data = 'xxx';
SET @@SESSION.block_encryption_mode = 'aes-256-cbc';
-- Convert the keyBase to binary SET @keyBaseBinary = CONVERT(@keybase USING utf8);
-- Convert the binary keyBase to Base64 SET @key = TO_BASE64(@keyBaseBinary);
-- Decode the keyBase from Base64 encoding SET @binary_encrypted_data = FROM_BASE64(@encrypted_data);
-- Extract the first 16 bytes from the decoded data as the IV SET @Iv = SUBSTRING(@binary_encrypted_data, 1, 16);
-- Remove the IV from the binary data SET @data_without_iv = SUBSTRING(@binary_encrypted_data, 17);
-- Decrypt the data using AES_DECRYPT in MySQL SELECT CAST(AES_DECRYPT(@data_without_iv, @key, @Iv) AS CHAR) AS decrypted_data;`
do you have any resources to use sql server