Database Encryption & Certificate creation

Source: Internet
Author: User

The following is a script that uses SQL Server to encrypt a database, which of course contains the steps to create a certificate:

 UseMaster;GO   --Drop master KeyCREATEMASTERKEYEncryption byPASSWORD= '123456'; GOBACKUPMASTERKEY  to FILE = 'D:\SQL1_master.key'Encryption byPASSWORD= '123456'; GO    CREATECERTIFICATE Tdecert withSUBJECT= 'TDE Certificate'; GOBACKUPCERTIFICATE Tdecert to FILE = 'D:\SQL1_master.cer'    withPRIVATEKEY (   FILE  = 'D:\SQL1_TDECert.pvk', encryption byPASSWORD= '123456'       );  UseTEST; GO   CREATE DATABASEEncryptionKEY    withAlgorithm=aes_128 Encryption bySERVER CERTIFICATE Tdecert;GOALTER DATABASETESTSETEncryption on--If you need to restore the encrypted database file to another server, you need to restore the certificate to the target server first:--the target server's master key can be different from the original server Usemaster; CREATECERTIFICATE Tdecert from FILE = 'D:\SQL1_master.cer'          withPRIVATEKEY (           FILE  = 'D:\SQL1_TDECert.pvk', decryption byPASSWORD= '123456'       ); 

Database Encryption & Certificate creation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.