merelyaboot-blog
merelyaboot-blog
Vepsun.in - The Best Training Institiute
1 post
Don't wanna be here? Send us removal request.
merelyaboot-blog · 8 years ago
Text
Best Oracle DBA Training Institute In Bangalore
Scramble/Decrypt clients delicate information by means of custom characterize method and capacities
A few times client demand to scramble his delicate information and decode it back at whatever point required. This might be the clients security approach.
With the underneath said tried philosophy, when information is embedded, the client really gives the plain content and oracle consequently changes over the plain content into scrambled shape and stores it in the information documents. Presently, at whatever point clients get to that information, Oracle unscrambles the information and show it to the clients. This encryption/unscrambling is totally straightforward to clients. So the general purpose behind straightforward encryption is to keep the touchy information in information documents safe.
Rundown of steps:
1. Make or call attention to the table with touchy data (designers)
2. Make encryption/decoding bundle (DBA)
3. Appoint consent on bundle made in step 2 to client/construction with touchy information (DBA)
4. Utilize diverse DML situation to scramble and unscramble data (designers)
STEP 1:
I am utilizing scott/tiger and a table "Clients" with "secret word" section containing touchy information
1.
$ sqlplus scott/tiger
SQL> select * from clients;
USERID USERNAME PASSWORD
- - -
1 GOURANGA GOURANGA123
2 JUSTEEN JUSTEEN001
3 HUSSAIN HUSSAIN980
STEP 2:
Interface with sysdba client make an encryption/unscrambling component for the secret word field.
$ sqlplus/as sysdba
SQL>
Make OR REPLACE PACKAGE enc_dec
AS
Capacity scramble (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC;
Capacity unscramble (p_encryptedText RAW) RETURN VARCHAR2 DETERMINISTIC;
END;
/
Make OR REPLACE PACKAGE BODY enc_dec
AS
encryption_type PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES
+ DBMS_CRYPTO.CHAIN_CBC
+ DBMS_CRYPTO.PAD_PKCS5;
/*
ENCRYPT_DES is the encryption algorithem. Information Encryption Standard. Piece figure.
Utilizations key length of 56 bits.
CHAIN_CBC Cipher Block Chaining. Plaintext is XORed with the past ciphertext
obstruct before it is scrambled.
PAD_PKCS5 Provides cushioning which consents to the PKCS #5: Password-Based
Cryptography Standard
*/
encryption_key RAW (32) := UTL_RAW.cast_to_raw('MyEncryptionKey');
- The encryption key for DES algorithem, ought to be 8 bytes or more.
Capacity scramble (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC
IS
encrypted_raw RAW (2000);
Start
encrypted_raw := DBMS_CRYPTO.ENCRYPT
(
src => UTL_RAW.CAST_TO_RAW (p_plainText),
typ => encryption_type,
key => encryption_key
);
RETURN encrypted_raw;
END scramble;
Capacity unscramble (p_encryptedText RAW) RETURN VARCHAR2 DETERMINISTIC
IS
decrypted_raw RAW (2000);
Start
decrypted_raw := DBMS_CRYPTO.DECRYPT
(
src => p_encryptedText,
typ => encryption_type,
key => encryption_key
);
RETURN (UTL_RAW.CAST_TO_VARCHAR2 (decrypted_raw));
END unscramble;
END;
/
STEP 3:
Give execution authorizations on the previously mentioned bundle to client scott.
$ sqlplus/as sysdba
SQL> allow execute on enc_dec to scott;
SQL> make open equivalent word enc_dec for sys.enc_dec;
Presently associate with sqlplus scott/tiger and test out the encryption/decription utilizing following situations
CASE 1:
SQL> select enc_dec.encrypt('Hello World') encoded from double;
Encoded
- - -
43718046FA0CFDD2581198FBF98DE2C5
/* A basic esteem scrambled utilizing the bundle we just made. */
select enc_dec.decrypt('43718046FA0CFDD2581198FBF98DE2C5') decoded
from double;
Decoded
- -
Hi World
CASE 2:
select * from clients;
USERID USERNAME PASSWORD
- - - -
1 GOURANGA GOURANGA123
2 JUSTEEN JUSTEEN001
3 HUSSAIN HUSSAIN980
SQL> refresh clients
set secret word = enc_dec.encrypt (watchword);
3 lines refreshed.
SQL> submit;
Submit finish.
/*
We just encoded the secret key information utilizing the calculation and key indicated in the
bundle ENC_DEC.
We likewise need to ensure any recently made record has Password esteem encoded utilizing
the bundle ENC_DEC.
*/
SQL> section secret key arrangement a32
SQL> select * from clients;
USERID USERNAME PASSWORD
- - - -
1 GOURANGA 03077889420F4348EEA75EDA4DA3F088
2 JUSTEEN E357A4E178A115FAF254EC08C0F97DE4
3 HUSSAIN 67EB9262394146787485B7C51F3E2889
/* All current passwords are presently scrambled */
Presently include one more record with scrambled secret word
SQL> embed into clients esteems (4,'Regis',enc_dec.encrypt('kU_Fi_4383'));
USERID USERNAME PASSWORD
- - - - -
1 GOURANGA 03077889420F4348EEA75EDA4DA3F088
2 JUSTEEN E357A4E178A115FAF254EC08C0F97DE1
3 HUSSAIN 67EB9262394146787485B7C51F3E2889
4 Regis C94F447042C428723B2F97393191DE65
With a specific end goal to decode the secret word
SQL> select userid,username,enc_dec.decrypt(password) from clients;
Note: You can utilize this arrangement to encode charge card data, bank a/c points of interest, any individual information and so on.
You can test yourself...
6 notes · View notes