Code example for BadPaddingException

Methods: getMessage

0
			return null; 
		} catch (IllegalBlockSizeException e) {
			logger.warning("IllegalBlockSizeException occured: " + e.getMessage());
			return null; 
		} catch (BadPaddingException e) {
			logger.warning("BadPaddingException occured: " + e.getMessage());
			return null; 
		} 
	} 
	 
	public static String encryptMD5(final String toEncrypt){
		byte[] bytesOfMessage;
		try { 
			bytesOfMessage = toEncrypt.getBytes("UTF-8");
			final MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] thedigest = md.digest(bytesOfMessage);
			final StringBuffer sb = new StringBuffer ();
			for (int i = 0; i < thedigest.length; i++){
				sb.append(Integer .toString((thedigest[i] & 0xff) + 0x100, 16).substring(1));
			} 
		   return sb.toString();