Keep User Information secure

Source: Internet
Author: User
Tags decrypt

Internet Information age, as long as the travel registration, you have to provide users with the relevant personal identification number, cell phone number, and other information, how to keep the user's information securely stored. Next, let me witness the powerful PostgreSQL. Install Pgcrypto encryption Module

#create extension pgcrypto;
CREATE EXTENSION

A number of commonly used decryption functions are provided here, which can be used directly in the system, such as: encrypt

# Select Encrypt (' 18600001111 ', ' test123456 ', ' AES ');
              Encrypt               
------------------------------------
 \x5893e4d2bc48c6538bf7e0db529fc54e
(1 row)

Using the AES algorithm to encrypt a phone number, the key is test123456. Decrypt

# Select Convert_from (Decrypt (' \x5893e4d2bc48c6538bf7e0db529fc54e ',  ' test123456 ', ' AES '), ' sql_ascii ');
 Convert_from 
--------------
 18600001111
(1 row)

A encrypt encrypted binary stream, decrypted, and the key is also test123456.
Convert_from is a function that converts a binary to a specified encoding.
As long as the save number key is resolved,

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.