Unusual Bad Padding Exception

I am writing a class to encrypt licencing information onto a text file in Base64 encoding. This write aspect works fine but the reading the licence back throw a Bad Padding Exception. (error and code below) Any assistance will be much appreciated
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
at com.sun.crypto.provider.AESCipher.engineDoFinal
(DashoA6275)
at javax.crypto.Cipher.doFinal(DashoA6275)
at Encryptor.encrypt(Encryptor.java:117)
at Encryptor.loadAllEncryptedLayerLicences
(Encryptor.java:158)
at Encryptor.main(Encryptor.java:183)
KeyGenerator kgen = KeyGenerator.getInstance("AES");
kgen.init(128);
SecretKey skey = kgen.generateKey();
byte[] raw = skey.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
//encrypt
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(value.getBytes());
//CONVERT TO BASE64 Encoding
String s = new sun.misc.BASE64Encoder().encode(encrypted);
//write the encrypted data to the file
fos = new FileOutputStream("C:\\aes\\output.properties");
new PrintStream(fos).println("layerhandle\t"+s);
fos.flush();
//fos.close();
//decrypt
byte[] buf = new sun.misc.BASE64Decoder().decodeBuffer(value);
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
//read from file and decrypt the values
byte[] unecrypted = cipher.doFinal(buf);
String word = new String(unecrypted);

String s = new
sun.misc.BASE64Encoder().encode(encrypted);
//write the encrypted data to the file
fos = new
FileOutputStream("C:\\aes\\output.properties");
new PrintStream(fos).println("layerhandle\t"+s);
fos.flush();
//fos.close();This looks suspicious. You should close the PrintStream and not just flush 'fos'. Closing the PrintSteam will close 'fos'. This failure to close the print stream could be the cause your problem.
>
>
//decrypt
byte[] buf = new
sun.misc.BASE64Decoder().decodeBuffer(value);If there is a problem with decrypt then it may be because you have not read the 'value' or the 'key' properly.

Similar Messages

  • Why bad padding exception???

    hi guys
    here i am trying to decrypt the already encrypted string by one different encrpytion algo.
    in the example i have encrypted the string by des and then i tried to decrypt it using blowfish but it gives as the output null instead of a random string...because of a bad padding exception(check line 86). help to remove the exception.
    if we try to decrypt the des encrypted string by des again it give n padding exception. why with blowfish???
    // CIPHER / GENERATORS
    import javax.crypto.Cipher;
    import javax.crypto.SecretKey;
    import javax.crypto.KeyGenerator;
    // KEY SPECIFICATIONS
    import java.security.spec.KeySpec;
    import java.security.spec.AlgorithmParameterSpec;
    import javax.crypto.spec.PBEKeySpec;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.PBEParameterSpec;
    // EXCEPTIONS
    import java.security.InvalidAlgorithmParameterException;
    import java.security.NoSuchAlgorithmException;
    import java.security.InvalidKeyException;
    import java.security.spec.InvalidKeySpecException;
    import javax.crypto.NoSuchPaddingException;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import java.io.UnsupportedEncodingException;
    import java.io.IOException;
    public class StringEncrypter {
    Cipher ecipher;
    Cipher dcipher;
    StringEncrypter(SecretKey key, String algorithm) {
    try {
    ecipher = Cipher.getInstance(algorithm);
    dcipher = Cipher.getInstance(algorithm);
    ecipher.init(Cipher.ENCRYPT_MODE, key);
    dcipher.init(Cipher.DECRYPT_MODE, key);
    } catch (NoSuchPaddingException e) {
    System.out.println("EXCEPTION: NoSuchPaddingException");
    } catch (NoSuchAlgorithmException e) {
    System.out.println("EXCEPTION: NoSuchAlgorithmException");
    } catch (InvalidKeyException e) {
    System.out.println("EXCEPTION: InvalidKeyException");
    public String encrypt(String str) {
    try {
    // Encode the string into bytes using utf-8
    byte[] utf8 = str.getBytes("UTF8");
    // Encrypt
    byte[] enc = ecipher.doFinal(utf8);
    // Encode bytes to base64 to get a string
    return new sun.misc.BASE64Encoder().encode(enc);
    } catch (BadPaddingException e) {
    } catch (IllegalBlockSizeException e) {
    } catch (UnsupportedEncodingException e) {
    } catch (IOException e) {
    return null;
    public String decrypt(String str) {
    try {
    // Decode base64 to get bytes
    byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
    // Decrypt
    byte[] utf8 = dcipher.doFinal(dec);
    // Decode using utf-8
    return new String(utf8, "UTF8");
    } catch (BadPaddingException e) {
    System.out.println("BAd padding excception");
    } catch (IllegalBlockSizeException e) {
    System.out.println("IllegalBlockSizeException");
    } catch (UnsupportedEncodingException e) {
    System.out.println("UnsupportedEncodingException");
    } catch (IOException e) {
    System.out.println("IOException");
    return null;
    public static void testUsingSecretKey() {
    try {
              String secretString = "code cant be decrypted!";
              SecretKey desKey = KeyGenerator.getInstance("DES").generateKey();
              SecretKey blowfishKey = KeyGenerator.getInstance("Blowfish").generateKey();
         StringEncrypter desEncrypter = new StringEncrypter(desKey, desKey.getAlgorithm());
              StringEncrypter blowfishEncrypter = new StringEncrypter(blowfishKey, blowfishKey.getAlgorithm());
              String desEncrypted = desEncrypter.encrypt(secretString);     
         String desDecrypted = desEncrypter.decrypt(desEncrypted);
         String blowfishDecrypted = blowfishEncrypter.decrypt(desEncrypted);      
         System.out.println(desKey.getAlgorithm() + " Encryption algorithm");
         System.out.println(" Original String : " + secretString);
         System.out.println(" Encrypted String : " + desEncrypted);
         System.out.println(" Decrypted String : " + desDecrypted);
         System.out.println();
         System.out.println(blowfishKey.getAlgorithm() + " Encryption algorithm");
         System.out.println(" Original String : " + desEncrypted);
         System.out.println(" Decrypted String : " + blowfishDecrypted);
         System.out.println();
         } catch (NoSuchAlgorithmException e) {
         public static void main(String[] args) {
         testUsingSecretKey();
    }

    peter_crypt wrote:
    you are right but this is my question. why cant we do that?? it should be possible.by the way i am working on a project for cryptanalysis . there i need to implement it.You need to spend more time studying and less time programming -
    1) Applied Cryptography, Schneier, Wiley, ISBN 0-471-11709-9
    2) Practical Cryptography, Ferguson and Schneier, Wiley, ISBN 0-471-22357-3
    3) Java Cryptography, Knudsen, O'Reilly, ISBN 1-56592-402-9 dated but still a good starting point
    4) Beginning Cryptography with Java, written by David Hook and published by WROX .

  • Bad Padding Exception using AES/ECB/PKCS5Padding

    Hi, I need some help Tryng to crypt and decrypt a String using AES/ECB/PKCS5Padding
    I paste my code below
    Crypt
    Cipher cipher;
             byte[] pass=new byte[]{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // just for example
            SecretKeySpec key = new SecretKeySpec(pass, "AES");
            cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
            cipher.init(Cipher.ENCRYPT_MODE, key);        
            byte[] utf8 = da_cifrare.getBytes("utf-8");
            byte[] enc = cipher.doFinal(utf8);
            String cifrata =new String (Base64.encodeBase64(enc));
            return cifrata;
    And on the other side Decrypt
    Cipher decipher;
               byte[] pass=new byte[]{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // just for example
               SecretKeySpec key = new SecretKeySpec(pass, "AES");
               decipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
               decipher.init(Cipher.DECRYPT_MODE, key); 
               byte[] buf =Base64.decodeBase64(da_decifrare.getBytes("utf-8"));
               byte[] recoveredBytes = decipher.doFinal(buf);
               String in_chiaro = new String (recoveredBytes,"utf-8");
               return (in_chiaro);I'm getting Bad padding exception when I try to Decrypt, any ideas ??

    Nothing obviously wrong but we have no view of your Base64 encoder and decoder. You should check
    a) that the bytes of your key are the same in both methods
    b) that the bytes resulting in your decrypt methodbyte[] buf =Base64.decodeBase64(da_decifrare.getBytes("utf-8"));are exactly the same as those created in the encrypt method using  byte[] enc = cipher.doFinal(utf8);
          Note - since Base64 consists of only ASCII characters you should use String cifrata =new String (Base64.encodeBase64(enc),"ASCII");and byte[] buf =Base64.decodeBase64(da_decifrare.getBytes("ASCII"));though this flaw should not be the cause of your exception.
    Edited by: sabre150 on Dec 15, 2009 12:32 PM

  • Bad Padding Exception

    I've got a small program to save/load passwords from a file, but the encryption is causing me a few issues, currently I'm stuck on a bad padding exception (line 120).
    The code can be found here: http://www.rafb.net/paste/results/R8NoZB78.html
    Does anyone know how I can resolve the error? Thanks.

        private String decrypt(String encrypted) {
            try {
                Cipher cipher = Cipher.getInstance("DES");
                cipher.init(Cipher.DECRYPT_MODE, key);
                return new String(Base64.decodeBase64(cipher.doFinal(encrypted.getBytes())));
            } catch (Exception e) { e.printStackTrace(); }
            return null;
        private String encrypt(String plaintext) {
            try {
                Cipher cipher = Cipher.getInstance("DES");
                cipher.init(Cipher.ENCRYPT_MODE, key);
                return new String(cipher.doFinal(Base64.encodeBase64(plaintext.getBytes())));
            } catch (Exception e) { e.printStackTrace(); }
            return null;
        }decrypt()
    string -> encrypted encoded bytes -> encoded bytes -> bytes -> string
    encrypt()
    string -> bytes -> encoded bytes -> encrypted encoded bytes -> string
    I do ask myself first. And no, I still don't get what the problem is - I really think there's something, probably very simple, that I don't know about and that's why I'm not getting this.

  • Bad Padding exception when trying to decrypt the file

    Hi i am trying to decypt a file in java which is encrypted in c++ but i get the pad padding exception
    javax.crypto.BadPaddingException: Given final block not properly padded
         at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
         at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
    public byte[] decrypt(byte[] str) {
    try {
    // Decrypt
         System.out.println("beforedecrypt-->"+str.length);
         byte[] input = new byte[64];
              while(true) {
                        int bytesRead = fin.read(input);
                        if (bytesRead == -1) break;
                        byte[] output = dcipher.update(input, 0, bytesRead);
                   byte[] output = dcipher.doFinal();
         // byte[] utf8 = dcipher.doFinal(str);
         System.out.println("afterdecrypt-->");
    // Decode using utf-8
    return output;
    } catch (javax.crypto.BadPaddingException e) {e.printStackTrace();}
    catch (IllegalBlockSizeException e) {e.printStackTrace();}
    catch (Exception e){e.printStackTrace();}
    return null;
    }

    MuppidiJava wrote:
    Sorry man..i got the same key in java..which you got i followed everything was mentioned... but i did not get the same key using C++ But did you compensate in your Java for the C++ bug I highlighted involving the creation of the bytes from the password? I bet you didn't. Did you even talk to your C++ guys about the bug? I bet you didn't.
    as i said i was not good at it..but your sample cpp code would have fixed it easily. Did you look at the Microsoft Crypto documentation? I bet you didn't. Did you try to learn enough C++ to add in the few lines of code needed to export and print out the generated key? I bet you didn't. Did you try to get the C++ guys to help you on this?
    I runing short of timeSorry but your time management problem is your problem.
    ..thanks for your support..The BadPaddingException problem you have is almost certainly as a result of you not generating the same key bytes in your Java as are being generated by the C++. Since you get the same bytes as I do when not compensating for the C++ bug it is almost certain that the C++ bug is the root cause of your problem. If I compensate for the C++ bug I get a match between my C++ key bytes and my Java key bytes. If you don't spend effort in understanding the C++ bug and how to correct for it in your Java you are stuffed. If you don't spend time learning enough C++ to be able to export the C++ key then you will have great difficulty in proving that you C++ key bytes actually match your Java key bytes. I have explained what the bug is - the Java code to compensate for the bug is actually trivial. I have explained how to export the C++ key - the C++ code for this is small and straightforward. I'm not going to provide the C++ code nor the Java compensation code. This is a 'forum' and not a programming service.
    P.S. You still have a problem with the '.' key on your keyboard.

  • Matrix Bad Value exception in ItemCode column

    hello ,
    i faced an exception with filling itemcode column
    As u know this column is linked object and have CFL (choose from list)
    the problem i faced that on choosing from list i choose an item to add new line in matrix
    this event done and a new line added sucessfully
    but the problem was with CFL , that it didnt able to close , it still opened and you need to press ESC or click on cancel to close it
    when i tracking the exception i found "Bad value" exception, although the itemcode column filled but the
    also i bind all matrix columns with data sources and i can fill matix at first , but when i want to add new line i faced this problem
    best regards and thank you in advance ....
    Ammar

    Thanks Rasmus,
    But that's something I've already tried - it doesn't seem to make any difference.

  • CCM enrichment BaDI implementation - exception handling

    Hello CCM Gurus,
    We're using CCM 2.0 version. I'd like to make an upload enrichment implementation, and raise an exception if one item has some problem. Every time if in the code an exception is raised according to one item, the whole catalog upload goes wrong, and the upload of the other good items go wrong as well. If it is possible I'd like to get a warning or an error message in SLG1 from the problematic items, but the correct items should be load into the catalog.
    If you have a sample implementation like this, what is solved this issue please send me.
    Thanks and regards
    Almos

    Hello Masa,
    Thanks for the helpful advice, the debugging is working now. Do you know some documentation or material where I can find some useful detailed infomation about using CCM BAdI?
    I don't know exactly the differences between the /CCM/CTLG_ENRICHMENT and the /CCM/CHAR_VALUATION BAdI. What is the prefered BAdI when you'd like to change or append uploaded CCM catalog data?
    Thanks and regards
    Almos

  • Bad Position Exception

    I have posted this in the concurrency thread, as I think this is a concurrency issue, but it is hard to know because my code is throwing exceptions that are hard to understand.
    The exception I am getting is "bad position" followed by a number, eg "bad position: 111787".
    This seems to happen when I am accessing a Vector, Hashtable or ByteArrayOutputStream in a multi-threaded program, so I am assuming it is some kind of concurrency issue. However, I would have expected to get a recognisable exception message such as "ConcurrentModificationException" or something like that.
    Does anyone have any idea what this exception is? Am I barking up the wrong tree in assuming it is a concurrency exception?
    Thanks

    Searching the JDK7 source gives
    sabre@beta:~/jdk7$ find . -name "*.java" -exec grep -il "bad position" {} \;
    ./jdk/src/share/classes/javax/swing/text/DocumentFilter.java
    ./jdk/src/share/classes/javax/swing/text/Document.java
    ./jdk/src/share/classes/javax/swing/text/JTextComponent.java
    ./jdk/src/share/classes/javax/swing/text/Segment.java
    Only Segment.java and JTextComponent have that as part of an exception (IllegalArgumentException) message.
    Since these are both Swing classes, if this is a concurrency issue then I would suspect it is caused by you not updating something in the Swing event thread.

  • How do you trap bad request exceptions

    Hi,
    Can anyone tell me how to catch an exception from the page flow request processor. I'd like to be able to trap requests to invalid .do and .jpf urls. I have exception handling in my Global.app, but that only seems to apply to exceptions generated by the page flow controller.
    At the moment I'm getting this magic html which I think is maybe hardcoded in one of the struts or workshop servlets?
    <html><head><title>Page Flow Error - Action Not Found</title></head>
    <body>
    <h1>Page Flow Error - Action Not Found</h1>
    <table border="1" cellspacing="0">
    <tr><td><b>Page Flow:</b></td><td>Global.app</td></tr>
    <tr><td><b>Action:</b></td><td>blah/something</td></tr>
    <tr><td><b>Form:</b></td><td>null</td></tr>
    </table>
    <span style="color:red">Unable to find action <b>blah/something</b>.</span>
    </body></html>
    thanks,
    laphroaig

    You can report a problem with a purchase as described on this page : http://support.apple.com/kb/HT1933
    There is this general feedback page for the iPad, but I think the above is probably better : http://www.apple.com/feedback/ipad.html

  • Bad pointer exception in Debug mode.. CView in CDockable pane MFC Feature pack

    Hi
    I have attached a CView in  CDockablePane and it works fine
    in Release mode but it throws bad memory pointer in
    debug mode while closing the application.(Crashing during close).
    Please advise...
    Find the code below how I had attached the View to Dockable pane
    //===================================================
    BOOL COutputWnd::AddView ( CRuntimeClass *pRuntimeViewClass, LPCTSTR lpcszTitle, int nIconIndex,int nTabIndex )
    if ( !pRuntimeViewClass )
    return FALSE;
    int nTabIndex = 0;
    CWnd *pWnd = NULL;
    CCreateContext newContext;
    CTestView *pView = NULL;
    newContext.m_pCurrentDoc = NULL;
    newContext.m_pNewViewClass = pRuntimeViewClass;
    newContext.m_pNewDocTemplate = NULL;
    TRY
    pWnd = ( CWnd* ) pRuntimeViewClass->CreateObject ( );
    if ( NULL == pWnd )
    AfxThrowMemoryException ( );
    CATCH_ALL ( e )
    TRACE0 ( "Out of memory creating a view\n" );
    return FALSE;
    END_CATCH_ALL
    if ( !pWnd->Create ( NULL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CRect ( 0, 0, 0, 0 ), &m_wndTabs, AFX_IDW_PANE_FIRST + nTabIndex, NULL ) )
    TRACE0 ( "Create view failed\n" );
    return FALSE;
    m_wndTabs.AddTab( pWnd, _T("Browser Tab"), (UINT)m_wndTabs.GetTabsNum());
    pWnd->SendMessage ( WM_INITIALUPDATE );
    pWnd->SetOwner ( this );
    pView = ( CTestView* ) pWnd;
    if ( NULL != pView )
    pView->Navigate2 ( lpcszTitle );
    return TRUE;
    }//===================================================
    Thanks
    Shajeer

    Hi
    I am calling the AddView from OnCreate of COutputWnd as below
    int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct){
    if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1;
    m_Font.CreateStockObject(DEFAULT_GUI_FONT);
    CRect rectDummy;
    rectDummy.SetRectEmpty();
    // Create tabs window:
    if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1)){
    TRACE0("Failed to create output tab window\n");
    return -1; // fail to create}
    AddView( RUNTIME_CLASS(CBrowserView),_T("www.google.com"),-1,0);
    return 0;
    Find below the call stack when it crashes
    Bad_Pointer.exe!AfxAssertValidObject(const CObject * pOb=0x00b7e838, const char * lpszFileName=0x014c58c8, int nLine=2372)  Line 99 + 0xa bytes C++
      Bad_Pointer.exe!CFrameWnd::AssertValid()  Line 2373 C++
      Bad_Pointer.exe!CMDIFrameWnd::AssertValid()  Line 384 C++
      Bad_Pointer.exe!CMainFrame::AssertValid()  Line 271 C++
      Bad_Pointer.exe!AfxAssertValidObject(const CObject * pOb=0x00b70068, const char * lpszFileName=0x014d5404, int nLine=288)  Line 107 C++
      Bad_Pointer.exe!CBasePane::GetParentMiniFrame(int bNoAssert=0)  Line 291 C++
      Bad_Pointer.exe!CDockablePane::OnDestroy()  Line 2579 + 0x12 bytes C++
      Bad_Pointer.exe!CTabbedPane::OnDestroy()  Line 215 C++
      Bad_Pointer.exe!CWnd::OnWndMsg(unsigned int message=2, unsigned int wParam=0, long lParam=0, long * pResult=0x001ae47c)  Line 2042 C++
      Bad_Pointer.exe!CWnd::WindowProc(unsigned int message=2, unsigned int wParam=0, long lParam=0)  Line 1755 + 0x20 bytes C++
      Bad_Pointer.exe!CBasePane::WindowProc(unsigned int message=2, unsigned int wParam=0, long lParam=0)  Line 1011 + 0x14 bytes C++
      Bad_Pointer.exe!AfxCallWndProc(CWnd * pWnd=0x00b90af0, HWND__ * hWnd=0x000114d8, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)  Line 240 + 0x1c bytes C++
      Bad_Pointer.exe!AfxWndProc(HWND__ * hWnd=0x000114d8, unsigned int nMsg=2, unsigned int wParam=0, long lParam=0)  Line 403 C++
      user32.dll!7787f8d2()  
      [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll] 
      user32.dll!7787f794()  
      user32.dll!7787f73d()  
      user32.dll!77880817()  
      user32.dll!77880a65()  
      ntdll.dll!776f99ce()  
      user32.dll!778714c8()  
      Bad_Pointer.exe!CMDIFrameWndEx::OnDestroy()  Line 777 C++
      90909090()
    Thanks!
    Shaj

  • BAD PARAM Exception

    Folks, My CORBA App is throwing the following exception:
    WARNING: "IOP00110201: (BAD_PARAM) Null parameter"
    org.omg.CORBA.BAD_PARAM:vmcid: SUN minor code: 201 completed: Maybe
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.nullParam (Unknown Source)
    This is being thrown from an IDL-generated Helper class of an object in the method 'public static void write()' in the line 'out.write_string(s.someString);'. This seems to be happening when the string 'someString' has a value of null. Can't a string have null value? Is this exception expected? Should all string values be necessarily non-null?
    Thanks.

    GSP wrote:
    Folks, My CORBA App is throwing the following exception:
    WARNING: "IOP00110201: (BAD_PARAM) Null parameter"
    org.omg.CORBA.BAD_PARAM:vmcid: SUN minor code: 201 completed: Maybe
    at com.sun.corba.se.impl.logging.ORBUtilSystemException.nullParam (Unknown Source)
    This is being thrown from an IDL-generated Helper class of an object in the method 'public static void write()' in the line 'out.write_string(s.someString);'. This seems to be happening when the string 'someString' has a value of null. Can't a string have null value? Err, apparently not...
    Is this exception expected? Should all string values be necessarily non-null?No, not all. But it can't be null in this case (given the provided details).
    It this application developed by a company called Atomikos?

  • NIO Bug Bad Address Exception

    I've been developing a file transfer system using the transferTo and transferFrom methods. My method will throw intermittently IOExceptions
    "Bad address". Has anyone else seen this? There is a bug report out on this however it was not reproducible. We are able to reproduce this error
    at an alarming rate. I am using java 1.4.0_01.

    There is a bug in 1.4.0.01 and there is no work around. I was force to use the old IO classes, and tweek the Garbage collector, and classes to ensure maximum through put. I was informed by the Java Team that this problem was fixed in 1.4.1. I that is not the case you will have to submit another bug report.

  • Can't authorize on Win7 E_AUTH_INVALID_KEY_DATA bad padding

    If I want to authorize my Digital Editions program on my Windows 7 32bit. If I enter my credentials I geht the
    error message you see in the subject.
    Tried it over several days.

    I'm afraid I don't think this suggestion will work in your case, but probably worth a try anyway ...
    Sometimes ADE gets its registration/activation confused and in a semi-authorized state.
    Unfortunately, it often then gives misleading error messages about what is wrong.
    Try completely removing any authorization using ctrl-shift-D to ADE (cmd-shift-D if on Mac).
    Restart ADE, and then reauthorize with your Adobe ID.

  • TS3293 All applications appear to respond to the touch pad, except for Facebook.  It takes a strange double click on each side of the  comment or like button.  This is running in safari.  The face book app doese not have that issue.

    While in Facebook and using safari or atomic web browser, I have to double click on one Sid of screen and the other very fast and sometime it will allow me to like or make a comment.  This does not happen with ipad face book app or any other applications. Just stated doing this yesterday
    Can anyone help, it is now very hard to use Facebook.
    Thanks
    Charboneau

    Facebook and mobile safari are not playing well together right now. It's an issue with facebook, not your iPad. The best you can do is find a work around until Facebook fixes it, if they ever do.

  • Given final block not properly not padded.....when given wrong password....

    hi..........sir
    when i am executing the following code..with wrong password....i am getting the BadPaddingException:Given final block not properly padded............
    plz help me to solve this one with the solution.
    I am doing my final project .....i am implementing an security protocol....
    here is thecode...
    String pw=JOptionPane.showInputDialog("enter the password string");
    byte[] pwb=new byte[pw.getBytes().length];
    pwb=pw.getBytes();
    String msg=JOptionPane.showInputDialog(null,"enter the message");
    byte[] msgb=new byte[msg.getBytes().length];
    msgb=msg.getBytes();
    try
    PBEKeySpec ks=new PBEKeySpec(pw.toCharArray());
    SecretKeyFactory skf= SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    SecretKey ky=skf.generateSecret(ks);
    MessageDigest md=MessageDigest.getInstance("MD5");
    md.update("srikrishna".getBytes());byte[] digest=md.digest();
    byte salt[]=new byte[8];
    for(int i=0;i<8;i++)
         salt=digest[i];
    PBEParameterSpec ps=new PBEParameterSpec(salt,20);
    Cipher cf=Cipher.getInstance("PBEWithMD5AndDES");
    cf.init(Cipher.ENCRYPT_MODE,ky,ps);
    byte[]thCp=cf.doFinal(msgb);
    for(int i=0;i<thCp.length;i++)
         System.out.print((char)thCp[i]);
    System.out.println("\n\n");
    String pwbs=JOptionPane.showInputDialog("enter the password string");
    byte[] pwbsb=new byte[pwbs.getBytes().length];
    pwbsb=pwbs.getBytes();
    PBEKeySpec ks1=new PBEKeySpec(pwbs.toCharArray());
    SecretKeyFactory skf1= SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    SecretKey ky1=skf1.generateSecret(ks1);
    MessageDigest md1=MessageDigest.getInstance("MD5");
    md1.update("srikrishna".getBytes());byte[] digest1=md1.digest();
    byte salt1[]=new byte[8];
    for(int i=0;i<8;i++)
         salt1[i]=digest1[i];
    PBEParameterSpec ps1=new PBEParameterSpec(salt1,20);
    Cipher cf1=Cipher.getInstance("PBEWithMD5AndDES");
    cf1.init(Cipher.DECRYPT_MODE, ky1,ps1);
    byte[]thPt=cf1.doFinal(thCp);
    for(int i=0;i<thPt.length;i++)
         System.out.print((char)thPt[i]);
    catch(Exception e)
         e.printStackTrace();
    Thanks in Advance.............
    Edited by: hareksna on Jan 12, 2009 4:36 PM

    hareksna wrote:
    sir, thanks for reply.........
    I understood .....
    sorry if am asking u once again.......
    for every encrypted data there will be an corresponding decrypted data.........even with the different key.....it shud produce some decrypted bytes.(even diff from plain text)......naa.....i.e it should produce the wrong plain text.......The encyption process -
    cleartext (adding padding) padded cleartext (encrypting) ciphertext.
    The decryption process -
    ciphertext (decrypting) padded cleartext (remove padding) cleartext.
    Even though it would be gibberish when the wrong key is used, you seem to want access to the 'padded cleartext' but using your code you do not have access to it. You could emulate the PBE process and get access to the 'padded cleartext' but what would be the point. You would just have gibberish when using the wrong key.
    but y the exception......
    ok ......and also tell me y this BPE is actually happens and how to avoid that when we use some padding.....
    plz tell me the reason.............Start by reading "Applied Cryptography"by Bruce Schneier and then "Practical Cryptography" by Ferguson and Schneier.
    >
    so finally .........
    u r saying that i need to catch the BPE and should inform client that he entered wrong password........
    so i have to end up in the second step itself.....
    is there any other way to perfom this one?......if there, plz let me know....if any alternative.....As I said earlier, the alternative is to emulate the PBE process yourself but what would be the point. You would just end up with gibberish if you use the wrong password.
    P.S. You won't always get a bad padding exception if you use the wrong password. About 1in 256 you will just get gibberish as the result without the exception.
    P.P.S. Your keyboard seems to have a problem with it's '.' key. In your place I would get it fixed because the perpetual '......' annoys the hell out of many people who respond to these forums.
    P.P.P.S. Your 'caps' key seems to be intermittently broken. Please get if fixed.
    P.P.P.P.S. You should turn off your computer's SMS mode. Using 'u' instead of 'you' makes your posts very difficult to read and it annoys the hell out of many people who respond to these forums.

Maybe you are looking for

  • How do I remove calendar alerts on my iPhone that were added when I installed Mountain Lion

    Just recently upgraded my Mac OS X to Mountain Lion.  Did notice though that all-day events in my Calendar now have alerts.  Was able to remove them from Calendar in my MacBook, but noticed that they're still there in my iPhone and iPad even after sy

  • How to Split long string and fixed as per text hight in SSRS

    Hi, IF my report text is like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa than text horizontally  coming like this only. but i have to write expression like it will be based on text width, means cut it down in next Row. Can Grow P

  • Clicking Links in Safari brings gibberish

    When I click on a link in Safari, I receive gibberish especially with pdf files. How can I correct this? Thanks for your help. Vernon

  • Ebay.in selling FAKE Nokia accessories

    Recently i purchased Nokia BH503 from Ebay.in and after receiving my order i found that I have received DUPLICATE NOKIA product.. I got confirmation from NOKIA CARE that this product is DUPLICATE, after so research i found all Nokia Accessories being

  • Moved photo to SD card storage - Revel stopped syncing

    Hi I have a Sony Z1. I was asked to move the images to the SD card due to lack of space. Accepted it and Revel stopped immediately synchronize photos taken with the phone camera. Images receive ex via WhatsUp is still synchronized. What to do? Magnus