我可以在 sql 命令之后从 sql server 执行创建这个,但是有没有办法使用 C# 代码执行这个命令?
sql命令...
USE master;
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'rajesh';
Go
Use Master
BACKUP MASTER KEY TO FILE = 'C:\Users\HP USER\Desktop\Encrypt\KEYs'
ENCRYPTION BY PASSWORD = 'rajesh'
GO
Use Master
CREATE CERTIFICATE mytestcert
WITH SUBJECT = 'Mytestcertificate'
Use Master
BACKUP CERTIFICATE mytestcert TO FILE = 'C:\Users\HP USER\Desktop\Encrypt\mytestcert.cer'
GO
CREATE DATABASE dbShop ;
GO
USE dbShop
GO
CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_256
ENCRYPTION BY SERVER CERTIFICATE [mytestcert]
ALTER DATABASE test
SET ENCRYPTION ON;