Mysql database field Encryption

Source: Internet
Author: User

1 database field Encryption:

2 4.20. Data encryption

3 There are many sensitive fields in the database that are not allowed to be viewed at will, such as developers, operations personnel, or even DBA database administrators. In addition, the main encryption is to prevent hackers to take off the library (stolen)

4 Sensitive data Encryption There are many ways, you can use the database internal encryption function, you can also write to the database after external processing. There are many kinds of encryption algorithms, but usually two kinds are commonly used, one is decrypted by key encryption, the other is decrypted by certificate encryption.

5 Usually the programmer is responsible for writing the program, the program to the operation and maintenance configuration, operation and maintenance of the key set up, operations can not have database permissions, DBA can only log in the database, no key permissions.

6 4.20.1. Aes_encrypt/aes_decrypt

7 Introduction to AES encryption and decryption simple usage

8 CREATE TABLE Encryption (

9 UserID int unsigned not NULL auto_increment,

User_password varchar (+) not NULL,

User_name varchar (+) not NULL,

PRIMARY KEY (UserID)

13);

INSERT into encryption (User_name,user_password) VALUES (' TestName ', Aes_encrypt (' 123qwe ', ' Encrypt_key '));

SELECT aes_decrypt (User_password, ' Encrypt_key ') from encryption WHERE user_name= ' testname ';

16

17 here it is convenient to demonstrate that the key is written to the database, and the actual application key should be stored in the application configuration file. Usually the person who gets the key should not use database permissions.


This article is from the "I am a Little bird" blog, please make sure to keep this source http://2242558.blog.51cto.com/2232558/1716460

Mysql database field Encryption

Related Article

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.