I will start by describing the issue / cause before asking my question:
If you are using a symmetric key in SQL to encrypt data. This can be set up as follows:
CREATE MASTER KEY ENCRYPTION BY PASSWORD='password'; CREATE CERTIFICATE My_Certificate AUTHORIZATION [dbo] WITH SUBJECT = 'My Certificate' CREATE SYMMETRIC KEY My_Key AUTHORIZATION [dbo] ENCRYPTION BY PASSWORD='CertificatePassword' WITH IDENTITY_VALUE = 'My Key', ALGORITHM = AES_256, KEY_SOURCE = '12345-AABB-1234-BBAA' ENCRYPTION BY CERTIFICATE My_Certificate;My_Certificate
This can then be used with the de/encryptbykey function(s) to encrypt data or vise-versa.
The issue is that data encrypted on SQL Server 2016 (or a previous version) is not accessible if moved to SQL Server 2017 (after re-applying the certificate that is).
This looks to be an issue with SQL Server 2017, See: https://support.microsoft.com/en-us/help/4053407/sql-server-2017-cannot-decrypt-data-encrypted-by-earlier-versions
And the suggested fix is to ensure you have CU2 installed and to globally enable trace-flag #4631
My question is: Is it possible (and if so how) to specify which hashing algorithm should be used.
For instance, can I tell SQL to use sha2_256 for example when encrypting my certificate?