DBMS_CRYPTO - Key length is limited to 8 characters

Hi, I have created a package to encrypt/decrypt the data.. But unfortunately it is considering only the first 8 characters to encrypt the data. Can anyone tell me why this behaviour and how can I fix this...
Also I would like to know is there a better way to do this...
PLEASE NOTE: when I change the key from v to w or when I change from 0 to 1 it’s the same hash value...
It takes the last two character pattern... for example, 2&3, 4 & 5, 6 & 7, 8 & 9, a & b, c & d etc., will get the same key... Also it is only using the first 8 characters to do the encryption.
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'v1qr3b9g') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','V1QR3B9G')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w1qr3b9g') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W1QR3B9G')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w0qr3b9g') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W0QR3B9G')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w0qr3b9ga') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W0QR3B9GA')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w0qr3b9gab') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W0QR3B9GAB')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w0qr3b9gcb') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W0QR3B9GCB')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL> select p_encrypt.encrypt_ssn('SUNILV,Kak93_dixj', 'w0qr3b9gcbddkkdkdkkakaaa') from dual;
P_ENCRYPT.ENCRYPT_SSN('SUNILV,KAK93_DIXJ','W0QR3B9GCBDDKKDKDKKAKAAA')
D4673C6035A01195D3BBB10F6AFA0BF44C673C79FE0044BF
SQL>
CREATE OR REPLACE PACKAGE SECURITY.p_encrypt is
FUNCTION encrypt_ssn ( p_ssn IN VARCHAR2
, p_key IN VARCHAR2 ) RETURN RAW;
FUNCTION decrypt_ssn ( p_ssn IN RAW
, p_key IN VARCHAR2 ) RETURN VARCHAR2;
END p_encrypt;
CREATE OR REPLACE PACKAGE BODY SECURITY.p_encrypt AS
FUNCTION encrypt_ssn( p_ssn IN VARCHAR2
, p_key IN VARCHAR2 ) RETURN RAW
IS
l_ssn RAW(30) := UTL_I18N.STRING_TO_RAW(p_ssn, 'AL32UTF8' );
l_encrypted RAW(30);
BEGIN
NULL;
l_encrypted := dbms_crypto.encrypt
( src => l_ssn,
typ => DBMS_CRYPTO.DES_CBC_PKCS5 ,
key => UTL_I18N.STRING_TO_RAW( p_key, 'AL32UTF8' ) );
RETURN l_encrypted;
END encrypt_ssn;
FUNCTION decrypt_ssn( p_ssn IN RAW
, p_key IN VARCHAR2 ) RETURN VARCHAR2
IS
l_decrypted RAW(30);
BEGIN
l_decrypted := dbms_crypto.decrypt
( src => p_ssn,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => UTL_I18N.STRING_TO_RAW( p_key, 'AL32UTF8' ) );
RETURN UTL_I18N.RAW_TO_CHAR( l_decrypted, 'AL32UTF8' );
END decrypt_ssn;
END p_encrypt;
/

Try to use 3DES or AES algorithms. DES algorithm uses 56 bit key.
And now about keys: in this case dbms_crypto substracts first 8 bytes of the key value and then uses last 7 bytes (56 bits).

Similar Messages

  • Filename lengths are limited to 31 characters?

    Why are filename lengths still limited to 31 characters?
    Why do the dialogs look like ports from the PC world?
    Is Logic Express itself a port from the PC world?
    Although Logic Express has its own slickness, Vision from OpCode Systems, was, considering when it was written, so much better, at least when working with MIDI. Adherance to Mac conventions was so good that it was an easy program to learn in spite of its complexity. Logic Express is proving to be difficult for me to learn with its quirky ways of doing things.

    "it's pretty difficult to put together something as complex as a modern, fully-featured DAW without making some concessions"
    "I'm sure it's a big-*** codebase, and probably not the easiest to patch for things that seem, from our perspective, to be simple."
    Actually I am aware of the difficulties in creating complex software. I was a software engineer from 1959 to 1993. (Yes, there were computers in 1959.) I'm always amazed -- not to mention pleased -- when a complex interaction among input, display, output, real-time constraints, on-the-fly editing, etc works without a hiccup. The modern, metaphorical graphical interface belies the complexity underneath. It's reminiscent of the unbelievable complexity which lies just under our own visual interface aka skin.
    I just wish that Apple had started with Opcode System's VISION product. Way back in OS 8, for example, one could have a display of a playing song and pull down a menu without interrupting either the display or the playing. With Logic the playing continues but the graphic display pauses. I know that this is not terribly relevant to anyone in the music business, but it would seem to reveal an old architecture forcibly fit to the new environment, and then I wonder about the things that I can't see.
    Well, I probably worry too much, because Logic Express has yet to crash or corrupt any of its files. And of course my whole music studio is, except for the MIDI keyboard, on my hard disk instead of the racks of equipment I used to have.

  • EVCOM: Character limitation of 256 characters?

    I am using BPC 5.1 and Excel 2003 to send comments using EVCOM.  It appears that the length of characters is limited to 256 characters.  From my research, I believe that this is a limitation of either Excel or SQL Server 2005 or both.  I believe Excel 2007 has a larger character limitation of 32kb but I have not been able to test this out.  Is is possible to send more than 256 characters using my current set up and if so how?  If not, is there any solution that will allow me to send more than 256 characters?

    In BPC 5.1, yes it's limited to 256 characters.
    Here's the schema, from ApShell. Note the COMMENT field in particular.
    Keyword, which you could be interested in if you're submitting comments from the action pane, is only 50 characters.
    CREATE TABLE [dbo].[CommentFinance](
         [RECORDID] [bigint] IDENTITY(1,1) NOT NULL,
         [USERID] [nvarchar](50) NOT NULL,
         [DATEWRITTEN] [smalldatetime] NOT NULL DEFAULT (getdate()),
         [KEYWORD] [nvarchar](50) NULL,
         [PRIORITY] [nvarchar](1) NOT NULL DEFAULT ((3)),
         [KPI] [bigint] NULL,
         [ACCOUNT] [nvarchar](20) NULL,
         [CATEGORY] [nvarchar](20) NULL,
         [DATASRC] [nvarchar](20) NULL,
         [ENTITY] [nvarchar](20) NULL,
         [INTCO] [nvarchar](20) NULL,
         [RPTCURRENCY] [nvarchar](20) NULL,
         [TIME] [nvarchar](20) NULL,
         [MEASURES] [nvarchar](20) NULL,
         [COMMENT] [nvarchar](256) NOT NULL,
    CONSTRAINT [PK_CommentFinance] PRIMARY KEY CLUSTERED
         [RECORDID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

  • Dynamic Configuration key length

    I am using dynamic configuration to set certain JMS properties but it appears that the maximum key length is 20 characters.
    Has anyone experienced this problem.  Is this a bug?
    Thanks
    Here is my code
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "com_inforecord_messageProcessor");
    conf.put(key1, "SoapMessage");

    Yes, is possible.
    Take a look here:
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=95093307
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/00a7ba12-e7cd-2b10-d589-e52b11346f77

  • OS X Support of Certificate Key Length

    I'm trying to import a self signed root certificate for our enterprise into a Lion machine's key chain and I'm getting an error message: "An error occured. Unable to import "<cert name>" Error -67762"
    The certificate has a key length of 8192 bits, signature algorithm of SHA256RSA.
    The subordiant certificate with a key length of 4096 bits, signature algorithm of SHA256RSA.
    Is there a limitation on the certificate key length that OS X Lion supports? Is this planned to be addressed in an update, or is there a way to change this?

    According to this document:
    https://developer.apple.com/library/mac/#documentation/security/Reference/keycha inservices/Reference/reference.html
    That error value is errSecInvalidAttributeKeyLength
    And I can confirm that the key length of 8192 bits is indeed the issue, as I came across this problem myself from generating a certificate key at that length.

  • Powerbook won't start - Disk Utility error "Invalid Key Length" - help plz!

    Hello
    I am having problem with my Titanium powerbook. Since it was refurbished I have only been using it for internet browsing and email and I don't know why it suddenly started freezing. After a couple of freezes it stopped starting up. I don't know why, as I wasn't doing anything unusual. I have run a few checks and don't know how to proceed. Please help.
    This is what I have done so far:
    1. Tried to start up in Safemode. Made the startup sound but then went dead.
    2. I tried Single User Mode and did fsck -fy and the results were:
    ** /dev/rdisk0s10
    ** Root file system
    ** Checking HFS Plus volume
    ** Checking Extents Overflow file.
    ** Checking catalogue file
    Invalid key length
    (4, 135)
    ** volume check failed
    localhost:/ root# Firewire (OHCI) Apple ID 18 built-in: no valid self IDs for more than 2 minutes after bus reset.
    3. No problems were detected by the Hardware Test disk.
    But the powerbook still won't start up properly. I can't get past the blue screen with the 'thinking' (rotating) circle icon (pinwheel?).
    4. When I try to access the computer using a firewire cable the hard disk doesn't appear on the host computer.
    5. I tried Disk repair Utility from startup using a disk but got the same result as with fsck -fy.
    Any ideas?

    Hi, Can't. Your hard drive's directory is damaged in a way that exceeds the limited repair capabilities of Disk Utility or fsck. DiskWarrior can fix "invalid key length" errors, as this short FAQ explains. If you have DiskWarrior, use it to make the repair. If you don't, you can either buy DW, or reformat the hard drive with Disk Utility and start over. Note that reformatting the drive will erase everything on it, so if there's any important, un-backed-up data on it that you can't afford to lose, buying DW will be the better option for you.
    Message was edited by: eww

  • Invalid key length on hard drive. Can this be fixed?

    Hello,
    I have a question about an error I am receiving with a hard drive I have been using for a few months on an imac G3 (the slot loading version). I bought this used 80 GIG hard drive on ebay for a friend of mine and I helped him transfer all his data from his older 9 GIG drive to this newer 80 GIG drive that I bought for him on ebay. I simply cloned the 9 GIG drive onto the new drive using Carbon Copy Cloner. There is not a lot of data on the drive - only about 3 GIGs of data.
    The drive is the only drive in the computer (an imac G3) and therefore it is the startup drive. The operating system on the drive is OS9. All was working fine for a few months until just last week. Now I am receiving this following error:
    error message:
    The disk "Macintosh HD" appears to be damaged. Use a disk repair utility to repair the disk.
    And so I used the disk utility built into OS9 to see if I could repair the problem. (I think OS9's disk utility is called "Disk First Aid")
    When using OS9s disk utility (I think it is called "Disk First Aid") the following report is issued:
    Problem: Invalid key length, 4,943
    Test done. Problems were found but Disk First Aid cannot repair them.
    My questions are:
    What is an "Invalid key length"?
    How serious is this?
    What would cause this?
    Could this have been caused by the physical condition of the disk or possibly by the software on the disk?
    Would re-formatting the drive fix it? (Of course I would try to save any data first onto another disk)
    Or is it risky to continue to use this disk even after reformatting it?
    I guess I have a lot of questions here and if anyone could make any suggestions or comment on why "Invalid key length" errors happen I would really appreciate it. Thanks:)
    Here are some details:
    When I bought the 80 GIG hard drive from ebay the first steps I took were to format the drive using OS9's "drive setup", load the OS9 drivers and then I verifed the disk. The disk seemed to be fine. Then I cloned his old drive onto this 80 GIG drive using Corbon Copy Cloner. I was sure the 80 GIG drive was in a healthy state at that time and I trusted it enough to give it to my friend for his startup drive. Now that the drive has failed with his data and programs, I feel pretty bad. How could this "Invalid key length" error occur?
    Should I go back to the person who sold me the drive on ebay and ask for a refund? Or are "Invalid key length" errors a common occurance with hard drives that should just be accepted? Or might it possibly be the contents (data) on my friend's disk that caused this error.
    It has been suggested to me to use "Tech Tools Pro" or "Disk Warrior" to repair the disk. Hopefully that might repair the disk. Unfortunately these programs are too expensive for this purpose because they would cost more than the computer actually costs (its an old imac G3 computer). I found a service that would run Disk Warrior on the disk to repair it for a $50 fee. Still, that is also not worth it as the computer may not even be worth $50.
    Here are some specifications:
    80 GIG drive specs: SEAGATE BARRACUDA 7200.7 80GB hard drive
    computer: imac G3 (slot loading version)
    OS: Mac OS9
    Thank you for any suggestions especially as to whether I should attempt to return the hard drive or look for a refund for this hard drive or attempt to reformat the drive and try again (backing up the data first).
    I also question the source of all the data on my friends computer. If he had the original operating system disks (which he said didn't come with his computer when he purchased it second-hand), I could have easily re-installed the OS and the applications. But he doesn't have any disks. That serves me right for having to deal with trying to help out someone who has software from a questionable source. I'm never doing that again. I guess that makes me guilty too as an accomplice. I don't feel very good about this
    I didn't know for sure - but I guess I should have assumed his software was illegal if he didn't have the disks - I was afraid to ask. I'm never putting myself in this possibly illegal situation again. Never again will I try to help someone out who doesn't clearly have the legal disks. Please forgive me and everyone else who reads this post. I feel shameful about this but somehow I must get myself out of this problem. I've learned a good lesson. Should I attempt to fix his computer? Or should I tell him to first buy a legal OS and software before I can help him out? You see I feel further guilt because I was the one who gave him the 80 GIG problematic hard drive that failed and I feel I should have to fix it. Can anyone offer me a bit of advice? What do I do?
    What's the right thing to do?

    Thank you Jim and Apple2Freak,
    I appreciate your comments. I am now suggesting to my friend to buy a legal OS and if that is the case I am suggesting to him to move to OSX instead of OS9. Luckily he let me know there wasn't much data on that drive that he needed to save. I am still trying to determine if I could still use this hard drive with the keylength errors if I erase it or if the hard drive has permanent damage. I am hoping that I could install OSX on it and erase the hard drive to start again.
    This imac (slot loading version) can support up to OS 10.3.9 however I might consider Xpostfacto to try to run 10.4. But then I would need to buy 10.3.9 as well as 10.4 and that would double my OS cost. I think I might just look for OS 10.3.9 only. Its not worth it for me to buy two OSes for it.
    Jim, your post was very interesting because it also pointed out that it could be an issue of bad RAM. A few months ago we installed some new second-hand RAM and I wonder if that is the cause of all these problems. I will have to check that first.
    Thanks again!

  • What's wrong with the built-in keyboard on my macbook? The caps button does not work rite, no matter what letter button i push they all come out capitals and the number keys when pushed display the special characters instead of the numbers!

    the built-in keyboard on my macbook is not functioning right, the number keys when pushed display the special characters instead of the numbers,
    the caps button doesn't work at all, the letter buttons display capitals when pushed whether the caps button is on or off, the shift keys are also out of whack!!
    It seems it somehow got relocated to the "0" button because if you push and hold the zero button down the keyboard seems to operate normally, the number keys display numbers when pushed the letter keys display lower case when pushed but release the zero button and your back in the twilight zone!! Can anybody help me resolve this issue? one more thing im using an external usb keyboard right now and it seems to function properly if that helps any.

    You would do better in the actual macbook pro forums (this is not).

  • How to refer the unlimited key length JCE jar files.

    Hi All,
    The JDK 1.4.2_10 contains the local_policy.jar and US_export_policy.jar that do not permit an unlimited Key length( 64 bit).
    - So I downloaded the unlimited ( Java(TM) Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 1.4.2
    ) https://jsecom15d.sun.com/ECom/EComActionServlet;jsessionid=0F59ACFF95A61F6C0E78B5CE8E0FA93B.
    -Now I want JDK to refer these files without changing anything in existing JDK ( Means I don't want to replcae the existing local_policy.jar , US_export_policy.jar ).
    - Is there any option or property which can tell the JDK to refer the other
    files instead of this location :- C:\bea\WLS8.1SP04\jdk142_05\jre\lib\security.
    Means I want to override these 2 existing files local_policy.jar , US_export_policy.jar without replcaing them.
    Any pointers will be highly appreciated.

    A year later, this is still an issue. No replies ( btw, this is my new login name for the forums ).
    Thank You.

  • What are the key benefits and limitations of new pricing model of X5-2?

    What are the key benefits and limitations of new pricing model that started with X5 version?

    1. Elastic Configurations
    Size/price hardware by the number of servers; Fixed configs no longer required
    Start with 2 Database Servers and 3 Storage Servers. Incrementally add database or storage servers online.
    2. Capacity-on-Demand (CoD)
    Upon installation, activate 40-100% of the cores per server and reduce software licenses; Applies to Eighth Rack now too
    Activate and license more cores when needed; Active cores may not be deactivated
    3. OVM and Trusted Partitions
    License software on Virtual CPUs within a VM; Ideal for special-purpose DB options
    You can mix different combination of options for different DB on one Exadata.
    OVM has no License cost; support is included with premier hardware support
    Limitation:
    At least 40% of usable cores on the machine must be licensed for Oracle software
    Cannot use both OVM and CoD to license less than 40% of cores
    A server must be virtualized or non-virtualized – not mixed
    A RAC cluster can mix virtualized and non-virtualized servers
    4. “Flash Drive” License Metric for EF Storage Server Software
    $20K/drive; 8 flash drives/EF server vs 12 disk drives/HC server = 33% higher list
    Can transfer licenses between Flash Drive (2 licenses/drive) and Disk Drive (1 license/drive) – part # is the same

  • Key length message - how to correct it?

    I added a couple of fields two an existing Z table (APPL0)
    and when I activate I am getting this warning message.
    Table ZMATLIST: Key length > 120 (Restricted functionality)
    Message no. DT214
    Diagnosis
    The key length, i.e. the sum of the field lengths of all the key fields of the table, is more than 120 bytes.
    System response
    This is a warning.
    Procedure
    Note the following restricted fuctionality for this table:
    - Table contents cannot be transported by specifying key values, at
      best by specifying generic key values with a maximum length of 120
      bytes.
    - The table may not be used as the base table of a lock object.
    (Couple of fields have check tables assigned to them already.)
    Since I want to transport contents of the table also, how to correct this message?
    Ven

    Check this thread..May be useful.
    Warning in SE11 - Defining tables.

  • Key length 120 (Restricted functionality) Error

    Hi Experts,
    I created a ZTable with 4 Primary Key fields.The sum of all these fields is 175.When I am activating the table it is showing the following error.
    Key length > 120 (Restricted functionality)
    Message no. DT214
    The key length, i.e. the sum of the field lengths of all the key fields of the table, is more than 120 bytes.
    Is there any solution to solve this problem?
    Regds,
    Sam.

    Dear saju sam
    Please goto change table in SE11 and remove the check boxes for primary key in table so that number of primary keys are reduced.And then activate before transporting.
    Please put ratings if this helps .

  • Maximum length of segment is 1000 characters, current length is 2382

    Hi,
    While activating the transfer rules i get this error message "Maximum length of segment is 1000 characters, current length is 2382". If someone has encountered such an error request you to kindly provide your inputs.
    Thanks
    Varun

    Hi Anil,
    Thanks for your response. It has been very helpful. Can u tell how we can change the transfer method. The option comes greyed out in BI system. So where exactly is this setting made?
    Varun

  • Sparseimage Fails Verification with Invalid Key Length error.

    I recently have been having some trouble with my computer. Every time I log out of my account, all of my preferences reset. This just now started happening. It was working fine, then all of a sudden it started to do this. This only happens on my account and doesnt with the root account. On looking up solutions, I discovered that I should verify my home directory image. I logged in as a different user (root) and used disk utility to verify it. However it failed saying "invalid key length" and "Error: The underlying task reported failure on exit". When I try to repair it, it gives me the same error. I backed up my system using superduper to an external drive a while back and verified the sparseimage file that I backed up. It failed with the same error.
    When I verify my harddrive it passes with no problem. Only my sparseimage file is corrupted. I would try diskwarrior but I cant afford it right now.
    Any help would be greatly appreciated. Thanks.
    Macbook   Mac OS X (10.4.9)   100gb hd; 1gb ram; Triple-Boot(OSX-Linux-Vista)

    Would that mean that I can't turn off filevault? Way I see it is that since the image file is corrupted, I would try to have filevault unencrypt it and see if it somehow fixes it. (Since there will be no longer a filevaut image to be corrupted). All of my data in the image file seems to be fine. Everything is still there and I can access everything.
    I was also thinking that I might be able to just copy everything in the image to my external, then deleting the account and create a new one, coping everything back over when im done.
    I know I probably sound like a noob, but im really not. Ive had a lot of experience with my computer, just not this sorta thing. Thanks for your help.

  • Bank Key length configuration

    Hello,
    where can we maintain the bank key length configuration specific to country?
    Thanks,
    Shilpa

    Hi,
    just to clarify my problem,  for a specific country the bank key lenght is set to 5 but i want to enter a bank key with length 7 for this country.
    this data is present in T005 but i am not sure from transaction i change this lenght.
    please help.
    Thanks

Maybe you are looking for

  • Sync problems while exporting

    Hi everyone-- I have one clip in my sequence where the audio was out of sync on the actual tape. In Final Cut, I was able to align it so that it matched up with the video. However, when I go to export, FCP realigns the video and audio how it was on t

  • [solved] openssl and gawk corrupted?

    I've just done pacman -Syu and it is what I've get: :: Retrieving packages from current... checking package integrity... archive openssl-0.9.8f-1-i686.pkg.tar.gz was corrupted (bad MD5 or SHA1 checksum) archive gawk-3.1.6-1-i686.pkg.tar.gz was corrup

  • Regarding report painter (GR52)

    Hi All, I need to chage a report painter. I can explain you this clearly with following example. BG10 this runs BSGC012A, BSGC012B, and BSGC012C  under the D1A folder of report painter. Now actually there are 13 company codes on the screen.Now we nee

  • Integration with SAP - Comparing SAP XI against other EAI Middlewares

    I highly appreciate if you could throw some of your expertise and insights to the following: 1.  What are all the architectural advantages if we use SAP XI instead of using other integration middlewares such as SeeBeyond, WebMethods etc. 2.  Most of

  • NO Event created for Customer Billing Document (VF01) in Work Flow

    Hi expert , I would like to trigger a work flow from the customer invoice created event. Bus Object should be "VBRK" or "BUS2037" ( Customer billing document ) But ,I cannot get any event after the billing transaction in VF01. I use the "SWEL" transa