Cannot use blowfish with key size 448 bit length

I can run it with at most 128 bits key size. I have tried it with 256 and 448 bits key size, all are failed. I'm using j2sdk1.4.1_01. How can I fixed this?
import java.io.*;
import javax.crypto.*;
import java.security.*;
public class MBlowfish {
     String m_sKeyFile = "";
     public MBlowfish (String sKeyFile) {
          m_sKeyFile = sKeyFile;
     * method genKey()
     public boolean genKey () {
          try {
               KeyGenerator keygen = KeyGenerator.getInstance ("Blowfish");
               keygen.init (448);
               SecretKey key = keygen.generateKey ();
               ObjectOutputStream keyFile = new ObjectOutputStream (
                    new FileOutputStream (m_sKeyFile)
               keyFile.writeObject (key);
               keyFile.close ();
               return true;
          } catch (Exception e) {
               //System.out.println (e.getMessage ());
               return false;
     * method readKey (String sKeyFile)
     private SecretKey readKey () {
          SecretKey key = null;
          try {
               ObjectInputStream keyFile = new ObjectInputStream (
                    new FileInputStream (m_sKeyFile)
               key = (SecretKey)keyFile.readObject ();
               keyFile.close ();
          } catch (Exception e) {
               //System.out.println (e.getMessage());
          return key;
     public byte[] encrypt (String sInput) {
          Provider sunJce = new com.sun.crypto.provider.SunJCE();
          Security.addProvider (sunJce);
          Cipher cipher = null;
          try {
               cipher = Cipher.getInstance ("Blowfish/ECB/PKCS5Padding");
               cipher.init (Cipher.ENCRYPT_MODE, readKey ());
          } catch (Exception e) {
               System.out.println (e.getMessage());
               return null;
          try {
               ByteArrayOutputStream bos = new ByteArrayOutputStream ();
               ByteArrayInputStream bis = new ByteArrayInputStream (
                    sInput.getBytes());
               CipherOutputStream cos = new CipherOutputStream (
                    bos, cipher);
               int length = 0;
               byte[] buffer = new byte[8192];
               while ((length = bis.read(buffer)) != -1) {
                    cos.write (buffer, 0, length);
               cos.close ();
               bis.close ();
               bos.close ();
               return bos.toByteArray();
          } catch (IOException e) {
               System.out.println (e.getMessage());
               return null;
     public String decrypt (byte[] baInput) {
          Provider sunJce = new com.sun.crypto.provider.SunJCE();
          Security.addProvider (sunJce);
          Cipher cipher = null;
          try {
               cipher = Cipher.getInstance ("Blowfish/ECB/PKCS5Padding");
               cipher.init (Cipher.DECRYPT_MODE, readKey ());
          } catch (Exception e) {
               System.out.println (e.getMessage());
               return null;
          try {
               ByteArrayOutputStream bos = new ByteArrayOutputStream ();
               ByteArrayInputStream bis = new ByteArrayInputStream (
                    baInput);
               CipherOutputStream cos = new CipherOutputStream (
                    bos, cipher);
               int length = 0;
               byte[] buffer = new byte[8192];
               while ((length = bis.read(buffer)) != -1) {
                    cos.write (buffer, 0, length);
               cos.close ();
               bis.close ();
               bos.close ();
               return new String(bos.toByteArray());
          } catch (Exception e) {
               System.out.println (e.getMessage());
               return null;
     public static void main (String args[]) {
          MBlowfish m = new MBlowfish ("BlowfishKey.ser");
          boolean result = m.genKey ();
          if (result) {
               System.out.println ("OK");
          } else {
               System.out.println ("Fail");
          byte[] baEncrypted = m.encrypt ("Hello this is a test message.");
          System.out.println (m.decrypt (baEncrypted));
}

Hi vorrarit,
sorry I couldn't help you. I tried your code one-to-one on my system and everything worked fine, which means that your configuration is somewhat messy.
BTW I read a little about jce and java 1.4.x (for I have java 1.3.06 and extra jce package), the documentation says, the SUN JCE providers are statically preconfigured, so a Security.addProvider(..) is not necessary. Have a look in the java.security file and check if the sun provider is contained. Are you sure, your runtime version points to the directory where the jce is installed, maybe you had installed other java-versions and the pathes got mixed up?
Good luck,
sebastian

Similar Messages

  • I cannot use itunes with windows 7. I think the problem has something to do with the fact that a 32 bit xp version was loaded on my machine. I can't uninstall it and the 64 bit version will not install.

    I cannot use tunes with windows 7. A 32 bit xp version was loaded from my prior computer. It will not uninstall. The 64 bit version will noit install.

    I cannot use tunes with windows 7. A 32 bit xp version was loaded from my prior computer. It will not uninstall. The 64 bit version will noit install.

  • Error GR410: characteristic cannot be combined with key figures

    Hi,
    My problem is in Report Painter.
    I need to add selection by trading partner (or by vendor) in report 6OBU-001. For this Iu2018ve modified reporting table RWCOOM, in order to make available characteristic RASSC in the library 6O2.
    Iu2019ve added Trading partner in General selection of my own report (copy of 6OBU-001), but RP gives an error message: u201CCharacteristic RASSC cannot be combined with key figures. Check the report definition: the key figures used must be compatible with characteristic RASSC. For examples of useful combinations of characteristics and key figures, see the SAP standard reports.u201D
    Any opinions are truly appreciated.
    Anton

    I read this note before, but I still don't know how to write a ABAP code.
    I need information from table COEP like sum of qunatity or costs. I have this information for  Cost Elements and Orders in CCSS but I don't have for Materials.

  • Report Painter - Characteristic cannot be combined with key figures

    Hi,
    I have added a new field (ZZABTEI) to the report structure CCSS and using that field as a characteristic in the report. But when I execute the report, it is giving the error "Characteristic ZZABTEI cannot be combined with key figures". Can anyone help me to solve this issue.
    Thank you,
    Rekha

    There no code for this. I had to add the new field to CCSS structure. Then there were some configuration to be done. Then this message is got when the report in the report painter is executed. The details of this error message is as follows :
    Characteristic ZZABTEI cannot be combined with key figures
    Message no. GR410
    Diagnosis
    Characteristic ZZABTEI is being used in a report with a key figure that does not match this characteristic.
    System Response
    The system cancels generation.
    Procedure
    Check the report definition: the key figures used must be compatible with characteristic ZZABTEI. For examples of useful combinations of characteristics and key figures, see the SAP standard reports.
    Technical explanation: The Report Writer table assigned to the report is defined as a view with multiple database tables (somewhat similar to Report Writer table CCSS) and a key figure used in the report refers to a database table which does not contain characteristic ZZABTEI.
    Example 1 for table CCSS: If the 'cost' or 'quantity' key figures are used in a report (referring to tables COSP and COSS), you cannot use the 'Statistical key figure' (only occurs in table COSR) characteristic in the rows. On the contrary, using the 'Cost element' (tables COSP and COSS) characteristic is not permitted for the 'Statistical quantity' (table COSR) key figure.
    Example 2 for table CCSS: If a report only displays line item data (key figures IE... or PE...), you cannot use the 'PERBL' characteristic, because it is only valid for summary data. You have to use the 'PERIO' characteristic for line item data.
    Thank you,
    Rekha

  • Unable to view external webcam content.  I'm using IE11 with Windows 7 64 bit.  I've tried deactivating Activex control, tried different browsers etc, tweeked the tools for trusted sites etc, but am totally stuck. I know the cams are working as i can view

    Unable to view external webcam content.  I'm using IE11 with Windows 7 64 bit.  I've tried deactivating Activex control, tried different browsers etc, tweeked the tools for trusted sites etc, but am totally stuck. I know the cams are working as i can view them on mobile phone via puffin browser.  I can play Youtube videos etc just fine. So why not the webcam?

    First, confirm that ActiveX Filtering is configured to allow Flash content:
    https://forums.adobe.com/thread/867968
    Internet Explorer 11 introduces a number of changes both to how the browser identifies itself to remote web servers, and to how it processes JavaScript intended to target behaviors specific to Internet Explorer. Unfortunately, this means that content on some sites will be broken until the content provider changes their site to conform to the new development approach required by modern versions of IE.
    You can try to work around these issues by using Compatibility View:
    http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
    If that is too inconvenient, using Google Chrome may be a preferable alternative.

  • Apple TV 1st generation cannot use AirTunes with Apple TV 2nd generation or Airport express 2nd generation

    Is it normal that Apple TV 1st generation cannot use AirTunes with Apple TV 2nd generation or Airport express 2nd generation? I want to play music synced in my ATV 1st gen. to a nymber of speakers in the house. In the list of speakers I can see Apple TV itself and my two Airport Expresses 1st generation but not my Apple TV 2nd generation or my Airport express 2nd generation. For the ATV 2nd gen. I found a solution: when I enable the Airplay setting of XBMC which is installed on my ATV 2nd generation, then AirTunes in ATV 1st gen. sees the speaker "XBMS (Apple-TV)". Itunes can in my Macbook pro can use Airplay with all my speakers, i.e. ATV 1st gen., ATV 2nd gen., Airport Express 1st gen., Airport Express 2nd gen.

    Last time I checked ATV1 could not use Airtunes to send audio to an AppleTV 2 or 3 - highly annoying as you think they would have kept backwards compatibiility for audio, but it seems Airplay is more than a superset of Airtunes.
    AC

  • Cannot use comparisons with column column references in pool and cluste

    Hi Experts,
    I  am facing an issue in a select statement written in 4.6 version and in that the table is a transparent table but when porting it to ECC6.0, it gives the follwing error:
    You cannot use comparisons with column column references in pool and cluster tables:'A~MATNR'. refe
    The select statement is as below:
    SELECT akschl alifnr amatnr aekorg awerks aesokz
             aknumh adatbi a~datab
             bmtart bmatkl
            b~yybcezndr " Commented as not required(IDE)
             cwerks cmmsta c~herkl
                INTO CORRESPONDING FIELDS OF TABLE  gt_a017
                FROM a017 AS a
               INNER JOIN mara AS b
                ON bmatnr = amatnr
                 INNER JOIN marc AS c
                   ON cmatnr = bmatnr
                  AND cwerks = awerks
                 INNER JOIN lfa1 AS d
                 ON dlifnr = alifnr
                WHERE a~kappl  = 'M'           AND
                      a~lifnr IN s_lifnr              AND
                      a~matnr IN s_matnr        AND
                      a~ekorg IN s_ekorg        AND
                     a~kschl  = v_kschl        AND
                      a~kschl  = gv_kschl       .
    Kindly help me out in this as A017 is a pooled table in ECC 6.0 . Thanks in advance!!!
    Thanks and Best Regards,
    Sahil

    Hi Sahil,
    Refer below code
    SELECT KSCHL LIFNR MATNR EKORG WERKS ESOKZ
           KNUMH DATBI DATAB
      FROM A017
      INTO IT_A017 " internal Table
      WHERE KAPPL = 'M' AND
            LIFNR IN S_LIFNR AND
            MATNR IN S_MATNR AND
            EKORG IN S_EKORG AND
    *         kschl = v_kschl AND
            KSCHL = GV_KSCHL .
      IF IT_A017[] IS NOT INITIAL.
        SELECT MATNR MTART MATKL
              FROM MARA
          INTO TABLE IT_MARA" internal Table
          FOR ALL ENTRIES IN IT_A017
          WHERE MATNR = IT_A017-MATNR.
        SELECT MATNR WERKS MMSTA HERKL
          FROM MARC
          INTO TABLE IT_MARC" internal Table
          FOR ALL ENTRIES IN IT_A017
          WHERE MATNR = IT_A017-MATNR AND
                WERKS = IT_A017-WERKS.
        SELECT LIFNR
          FROM LFA1
          INTO IT_LFA1" internal Table
          FOR ALL ENTRIES IN IT_A017
          WHERE LIFNR = IT_A017-LIFNR.
        ENDIF.
    After this use READ statement and fill the data in final internal table..
    Please search on SCN for more information about how to use FOR ALL ENTRIES..
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7
    ilesh Nandaniya

  • Cannot use scanner with WLan with Advent AW10 printer

    I have a Satellite L500D-11R using Windows Vista.
    I have purchased an Advent AW10 printer with wi-fi functionality.
    I am able to print documents and photos with no problem, however I cannot use the scanner with wi-fi.
    After several lengthy talks with Advent support, not very useful, I was asked if I had Twain_32 on my laptop.
    I have searched my machine and there is no trace of Twain.
    I need to download a current version of Twain_32 and have been told to get this from the supplier of my laptop.
    The web, I have learnt, is not the safest way to download Twain_32 due to security issues.
    I have looked for a Toshiba and Microsoft download with no luck.
    Can anyone help?

    Hi mate
    I think this is not a Toshiba issue but this question should be addressed to the manufacturer support of printer.
    However, our community tries to help everyone as good as possible
    I searched a little bit and found this youtube video how to repair TWAIN_32.DLL error
    http://www.youtube.com/watch?v=H6nLWR9TLgY
    Otherwise you will need a support from printer manufacturer

  • Cannot use OK with Tab

    Hello,
    I've created a form with screenpainter. It has to 2 edit fields and 1 button.
    When I load the form and use the TAB key, it only switches between the edit fields and doesn't go to the button. I'm using 2004.
    What am I doing wrong.

    Hi,
    This is standard behavior in SBO. The button never gets focus. To be able to execute the code behind the button when you press a key you can set the button to default. On the form properties you have a DefaultButton property. This code will execute when you press the enter key when any of the controls are selected.
    Hope this helps,
    Adele

  • Cannot use Chess with this version of Mac OSX...?

    When I first installed Leopard, Chess (the Apple app) worked fine. Now, after updating to 10.5.1 I get a message saying I can't use it with this version of OSX when I try to open it. Any idea why? Can I get Chess back? Is it just me?

    Andrew Butterfield wrote:
    Obviously some little glitch, but now it's working fine. Just wish I could beat it occasionally. Still, hope lies eternal...
    It is likely that in the Dock, you had a pointer to the pre-Leopard version of Chess left over from an upgrade or archive & install, so that version was trying to launch from the Dock. "Get Info" tells me that Leopard's Chess is version 2.3 & it even has a checkbox for "Open in 32 bit mode" -- something I haven't seen before.
    If you have any other similar Dock-related glitches, use the "Show in Finder" Dock menu option to find the app & see if it looks like a Tiger "leftover."

  • Cannot use subpages with WRT160n

    Hi all, I just bought a WRT160N-EW and connected a computer (wired) and a laptop (wireless). But now I cannot use more than 1 (one) page at a time. More pages cannot connect to the internet.
    Please help!?!
    Frans

    Are you getting the problem on the wired computer or on the wireless computer...or on both computers...?
    Try this..
    Open an Internet Explorer browser page on your wired computer(desktop).In the address bar type - 192.168.1.1 and press Enter...Leave Username blank & in Password use admin in lower case...
    On the set-up tab change the MTU Size to 1300 and click Save Settings...
    Click on Advanced Wireless Settings
    Change the Beacon Interval to 75 >>Change the Fragmentation Threshold to 2304, Change the RTS Threshold to 2304 >>Click on "Save Settings"...
    Now see if it works for you...

  • Cannot use Safari with this version of OSX??

    I recenlty installed Leopard on my G5 (pre-Intel but with 2GB). I have iLife 08 and Safari 3.
    On one of the Account windows I get the message that "You cannot use the application Safari with this version of Mac OS X".
    It works fine on my (administrator) account.
    Any thoughts on this one please.
    BTW, it is my children's account and I have some (but not stringent) parental controls.

    Alternatively, see the steps I posted for resolving conflicts/corrupt plists within an account at:
    http://discussions.apple.com/thread.jspa?messageID=4703015

  • Cannot Use ichat with this version of OSX

    Please help!
    I installyed leopard and now when I try to use ichat I get the a message saying I can not use ichat with this version of OSX. What can I do to try to fix this?
    Thanks!

    Also Click and hold the icon in the DOCK and Use Show In Finder.
    When you get to the folder that the version of iChat the DOCK is linked click on the title of the Window to see the path to the Folder.
    An Archive and Install may include a Previous System part.
    You should see
    Applications
    Hard Drive (name)
    Computer (Name)
    NOT
    Applications
    Hard Drive
    Previous Systems
    Hard Drive
    Computer
    3:20 PM Saturday; December 29, 2007

  • Cannot use Battery with Logic pro

    An Know how to use battery2 with logic
    because seems the logic au managerr can't find battery

    hi
    did you run the au validation programm? maybe if the validation crashed or didnt work you should update battery with the au hotfixes. battery 1 and 2 working for me since first installation.
    if the registration of battery or other plug-ins expired they will also crash in the au manager.
    best
    marc

  • Cannot use 3G with macair since upgrading

    cannot use my 3G since upgrading to Yosemite

    You may need updated drivers. Since you've provided no details on the maker, I'll just say "Google it."

Maybe you are looking for

  • Formula Variable in BEx

    Hi All, Can some one explain to me whta a formula variable is all about and how it works. With an example or point to some document for the same...it will be very helpful. Thanks in advance. Tina

  • Insert hyperlink into Text Item

    I'm looking to create a footer text item for all reports that has a link that will launch an email to the BI team.  I was able to find some javascript that I can use to launch Outlook but I can only get it to work with a button item or link item.  I

  • White border around the picture when it prints

    How do i get the white border off of my picture when i print my picture?

  • Display boolean

    Hi.... I am very new to Oracle and trying to learn SQL/ PL/SQL.I want to display a boolean b using a dbms_output.put_line. I use the following code: declare b boolean:=true; begin dbms_output.put_line(b); end; It gives the following error: ERROR at l

  • Error: method extraHandlePCFinally(javax.servlet.jsp.PageContext, boolean)

    I have the same error, im using jdeveloper 10g(9.05.2)