Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners javax.crypto.BadPaddingException

Have Programming Question? Ask it here!
 
 
 


Java Coder
javax.crypto.BadPaddingException
1 Answer(s)      8 months ago
Posted in : Java Beginners


javax.crypto.BadPaddingException


Advertisement
View Answers

December 24, 2013 at 4:24 PM


Here is the method to convert a hex string to a byte array:

public static byte[] fromHexString(String s) {
    int len = s.length();
    byte[] data = new byte[len / 2];
    for (int i = 0; i < len; i += 2) {
        data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                             + Character.digit(s.charAt(i+1), 16));
    }
    return data;
}

//change the method  to use as follows:

original = cipher.doFinal(fromHexString(message));


Related Tutorials/Questions & Answers:
javax.crypto.BadPaddingException
javax.crypto.BadPaddingException  javax.crypto.BadPaddingException
Authentication of password - Swing AWT
java.io.*; import javax.crypto.Cipher; import javax.crypto.BadPaddingException
Advertisements
Advertisements
 

 

 

DMCA.com