10 Replies Latest reply on Apr 20, 2010 8:27 PM by Sachin

    Informatica AES Encryption

    New Member

      Just wondering if Informatica built in function AES_ENCRYPT (128 bit) will generate the same result as that of Oracle's DBMS_Crypto (dbms_crypto.encrypt_aes128 ) assuming we use the same Key in both of them.  

       

      Looks like we have to define the character set when using DBMS_Cyrpto, where as Informatica AES_ENCRYPT does not have an option to choose a character set.  How do we know on what character set Informatica is using.

       

      Any insight would be appreicated.

       

      Thanks.

        • 1. Re: Informatica AES Encryption
          Sachin Guru

          Currently, AES_ENCRYPT function uses the combination as follows which is expressed in terms of funtions in DBMS_CRYPTO package of Oracle:

           

          DBMS_CRYPTO.ENCRYPT_AES128 + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_ZERO

           

          If any other padding technique is used then it generates a different value. Not sure if characterset makes a difference.

           

          A FR 205205 is raised to enhance the feature by accepting more arguments like padding techniques etc

          1 of 1 people found this helpful
          • 2. Re: Informatica AES Encryption
            New Member

            Thanks for quick response.  My goal is to generate same encrypted value between Informatica and Oracle using AES128 encryption.

             

            When I use PAD_ZERO with character set 'AL32UTF8' for dbms_crypto, I do not get same value as that of Informatica - AES_ENCRYPT.  Here is my code sample. Could you please tell me if something is missing here?  Thanks.

             

             

            CREATE OR REPLACE PROCEDURE encrypt_stb_id_orcl(
                stb_id         IN VARCHAR2,
                encrypted_raw OUT VARCHAR2)
            IS


            G_CHARACTER_SET  VARCHAR2(10)   := 'AL32UTF8'; 
            G_STRING         VARCHAR2(255)  :=  rpad(  'abcdefgh', (TRUNC(LENGTH(stb_id)/8)+1)*8, chr(0) );
            G_KEY    RAW(250)       :=  utl_i18n.string_to_raw( data => G_STRING,dst_charset => G_CHARACTER_SET );

                                              
            G_ENCRYPTION_TYPE PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_AES128 + DBMS_CRYPTO.CHAIN_CBC + DBMS_CRYPTO.PAD_ZERO;


            l_stb_id RAW(100) := UTL_I18N.STRING_TO_RAW( stb_id, G_CHARACTER_SET );   
            l_encrypted       RAW(100);


            BEGIN 

            l_stb_id      := utl_i18n.string_to_raw( data =>stb_id ,dst_charset => G_CHARACTER_SET );
            encrypted_raw := dbms_crypto.encrypt( src =>  l_stb_id, typ => G_ENCRYPTION_TYPE, key => G_KEY );

             

            END encrypt_stb_id_orcl;
            /

            • 3. Re: Informatica AES Encryption
              Sachin Guru

              Is your integration service running on Unicode mode? Looks like it needs to run in ASCII mode for the values to be same

              • 4. Re: Informatica AES Encryption
                New Member

                Sachin -

                1. How do I findout on which mode the Informatica server is running?

                2. How do I specify the ASCII character set when using DBMS_CRYPTO package? In the code sample that I posted, should I used "US7ASCII" instead of "AL32UTF8"  for character set?

                 

                Thank you.

                • 5. Re: Informatica AES Encryption
                  Sachin Guru

                  You can check the session log for the following message

                   

                  Server Mode:

                  Or

                  Server Mode:

                   

                   

                  Using AL32UTF8 is fine

                  1 of 1 people found this helpful
                  • 6. Re: Informatica AES Encryption
                    New Member

                    Sachin - I see that the Server Mode: ASCII.

                     

                    In that case, I am not sure why Informatica is generating different encryption values when compared to dbms_crypto?  Any advice!!!

                     

                    Thanks for your help.

                    • 8. Re: Informatica AES Encryption
                      New Member

                      Sachin - I tried this code and gives the error "ORA-28234 "Key length too short."  while exectuion.

                       

                      I am using the same 8 byte key which I used in Informatica AES_Encrypt function.  The key works fine with AES_Encrypt function but throws error while running using the db function.

                       

                      Appreciate any help.

                       

                      Thanks.

                      • 9. Re: Informatica AES Encryption
                        Sachin Guru

                        Even I get the same error when running the DB function

                        • 10. Re: Informatica AES Encryption
                          New Member

                          Ok -:)

                          Thanks.