MySQL Forums
Forum List  »  Italian

Re: Crittografia mysql
Posted by: Gavin Towey
Date: June 03, 2010 12:01PM

Ciao Antonio,

Allora, questo e' un grande topico. La prima risposta e', il metodo dipende dai bisogni.

MySQL non supportare ne i tabelli ne database interi crittografici. Se e' necessario crittografare un database intero, forse meglio usare un utile che crittografare tutto sul tuo hard disk (http://www.ilbloggatore.com/2009/09/23/diskcryptor-criptare-hard-disk-e-partizioni-in-modo-da-rendere-sicuri-i-nostri-dati/) Quello, per esempio. Con linux mi sembra che anche ci sia utili.

Pero, poche persone veramente ha un bisogno di crittografare un disk intero. In realta, solo poche campi in una tabella.

Per quello, si puo' usare funzioni nel MySQL. AES_ENCRYPT() e AES_DECRYPT(). encrypt produrera' un risulto di 16 bytes per only frazione di lunghezza di 16 che ha il string originale.

Per esempio, se hai un nome di lunghezza 5, il resulto sara' 16 bytes. Se hai un nome di lunghezza 17 o anche 16, il risulto sara 32 bytes, e cosi' via.


CREATE TABLE utenti (
nome VARCHAR(40),
carte_di_credito BINARY(32) );

INSERT INTO utenti (nome, carte_di_credito) VALUES ('paolo', AES_ENCRYPT('4111111111111111','passaparola') );

SELECT nome, AES_DECRYPT(carte_di_credito, 'passaparola') AS carte FROM utenti;


Buona fortuna!

Options: ReplyQuote


Subject
Views
Written By
Posted
5345
June 03, 2010 06:53AM
Re: Crittografia mysql
5804
June 03, 2010 12:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.