Database data encryption and decryption

Source: Internet
Author: User

MVC's practice journey is going to be another phase that will add to the membership function. Before entering, some preparatory work needs to be done. Step by step it. Design member function, where password field, insus.net want to encrypt it. Because of this encryption, it will take some time to tidy up.
Insus.net refer to the MSDN website for a list of database encryption and decryption examples (the following are performed in SQL Server 2012):

--Create DATABASE master key creation master key encryption by PASSWORD = ' Pass#tutorial#word ' GO

--Creating a certificate Create CERTIFICATE Passwordcert with SUBJECT = ' Member Password CERTIFICATE ' GO

--Creating an asymmetric key create asymmetric key passwordasymmetric with    algorithm = rsa_2048--{rsa_512 | rsa_1024 | RSA_2048}     encryption by PASSWORD = ' Pass#tutorial#word '; GO

--Creating a symmetric key create symmetric key passwordsymmetric with    algorithm = aes_256--{aes_128 | aes_192 | aes_256 | Triple_des_3key}    encryption by PASSWORD = ' Pass#tutorial#word '; GO

--Encrypted symmetric key by certificate create symmetric key Symmetricbycert with    algorithm = aes_256    encryption by CERTIFICATE Passwordcert ; GO

--encrypted symmetric key by symmetric key open symmetric key passwordsymmetric    decryption by password= ' Pass#tutorial#word ' CREATE symmetric key Symmetricbysy with    algorithm = aes_256    encryption by symmetric KEY passwordsymmetric; GO

--symmetric key encryption by asymmetric key create symmetric key symmetricbyasy with    algorithm = aes_256 encryption by    asymmetric key Passwordasymmetric; GO



After it is created, it will be displayed below the corresponding database, as follows:

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.