In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "AES decryption abnormal Given final block not properly padded how to do", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "AES decryption abnormal Given final block not properly padded how to do" this article.
On-line encryption and decryption of AES 128Blue192 and256-bit CBC/CFB/ECB/OFB/PCBC
Decrypted content: 1243CFEBD819AA6B1C717DE870459F7B
Secret key: http://www.it399.com
No fill vector iv is used
AES decryption exception Given final block not properly padded
Javax.crypto.BadPaddingException: Given final block not properly padded
At com.sun.crypto.provider.CipherCore.doFinal (CipherCore.java:966)
At com.sun.crypto.provider.CipherCore.doFinal (CipherCore.java:824)
At com.sun.crypto.provider.AESCipher.engineDoFinal (AESCipher.java:436)
At javax.crypto.Cipher.doFinal (Cipher.java:2165)
Reason: decryption directly to the input hexadecimal value: 1243CFEBD819AA6B1C717DE870459F7B took getBytes, so the length of the byte array obtained is 16, can not be operated directly.
InputValue.getBytes (AESUtil.CHARSET)
You need to convert the hexadecimal to-byte array so that the content is 32 bits, and it is different from the byte array directly obtained before.
TypeConvert.hexStringToBytes (inputValue)
Hexadecimal rotation byte array method
/ * *
* Convert hex string to byte []
*
* @ param hexString the hex string
* @ return byte []
, /
Public static byte [] hexStringToBytes (String hexString) {
If (hexString = = null | | hexString.equals ("")) {
Return null
}
HexString = hexString.toUpperCase ()
Int length = hexString.length () / 2
Char [] hexChars = hexString.toCharArray ()
Byte [] d = new byte [length]
For (int I = 0; I < length; iTunes +) {
Int pos = I * 2
D [I] = (byte) (charToByte (hexChars [pos]))
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.