Tuesday, September 23, 2008

Free Blog Spot Dad&son

Storing Passwords In The Database 10G


DBMS_CRYPTO
DBMS_CRYPTO

The package is a replacement for the
DBMS_OBFUSCATION_TOOLKIT
package available in Oracle 8i and 9i. The new package is Easier to use and contains more cryptographic algorithms:


Source

{ORACLE_HOME} / rdbms / admin / dbmsobtk.sql

Cryptographic algorithms - DES, 3DES, AES, RC4, 3DES_2KEY

Padding forms - PKCS5, zeroes


Block cipher chaining modes - CBC, CFB, ECB, OFB

Cryptographic hash algorithms - MD5, SHA-1, MD4

Keyed hash (MAC) algorithms - HMAC_MD5, HMAC_SH1

Cryptographic pseudo-random number generator - RAW, NUMBER, BINARY_INTEGER

Database types - RAW, CLOB, BLOB

A simple example of it's usage is:


SET SERVEROUTPUT ON
DECLARE
l_credit_card_no VARCHAR2(19) := '1234 5678 9012 3456';
l_ccn_raw RAW(128) := UTL_RAW.cast_to_raw(l_credit_card_no);
l_key RAW(128) := UTL_RAW.cast_to_raw('abcdefgh');

l_encrypted_raw RAW(2048);
l_decrypted_raw RAW(2048);
BEGIN
DBMS_OUTPUT.put_line('Original : ' UTL_RAW.cast_to_varchar2(l_decrypted_raw));
END;
/
Original : 1234 5678 9012 3456
Encrypted : 3041423134363932354234374545463631304337384433354443433736323331354244454237324635314545
Decrypted : 1234 5678 9012 3456

PL/SQL procedure successfully completed.

0 comments:

Post a Comment