Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: DESEncrypt & DESDecrypt in Oracle 8i

Re: DESEncrypt & DESDecrypt in Oracle 8i

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: Thu, 11 Jan 2001 15:54:00 GMT
Message-ID: <3A5DD718.424B0BF1@edcmail.cr.usgs.gov>

You can not change the restriction of the package where the string to be encrypted must be a multiple of 8 bytes. But you can do some work to get your string to match that qualification....

Let's say that the password you want to encrypt will be at most 12 characters. And let's further say that the password can be any length up to the 12 characters. Before you encrypt the password, use the RPAD function to add blank spaces up to the next multiple of 8 greater than 12 characters. The next multiple of 8 greater than 12 is of course 16. In my PL/SQL block, further assume that the variable 'pswd' contains the current password and that you want to put the pswd that is a multiple of 8 into the variable 'mult8_pswd'. Then your code should have a line like:

   mult8_pswd:=RPAD(pswd,16,' ');
Then pass mult8_pswd to the DESEncrypt function.

When decrypting, use RTRIM to remove the padded blanks at the end!

HTH,
Brian

bashar77_at_my-deja.com wrote:
>
> Hi there,
> I'm using the Oracle supplied package DBMS_OBFUSCATION_TOOLKIT
> for encrypting and decrypting data in the database.
> I want to create a table for user information including their password
> but I want to store the password encrypted.
> The problem is that the functions DESEncrypt & DESDecrypt operates on a
> string of size multiple of 8 bytes, where I can't force the user to
> select a password that is exactly 8 bytes or a multiple of it.
> What should I do to use this package and not having that restriction??
> Also, if there is another good alternative to using the
> DBMS_OBFUSCATION_TOOLKIT package, please inform me.
>
> Thanks in advance.
> Bashar.
>
> Sent via Deja.com
> http://www.deja.com/
 

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Thu Jan 11 2001 - 09:54:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US