Current location - Quotes Website - Signature design - How to solve sm4 pad block corrupted
How to solve sm4 pad block corrupted

The error problem of pad block corrupted is very common. The origin will be analyzed below:

First of all, because the company is about to connect to the life shopping platform of Hong Kong Wing Lung Bank (company business scenario: it Embed the application of Yifei Bank and pull out the corresponding interface function), the other party directly sent the interactive document API, but during the reading process, it was found that when calling the other party's payment interface, the other party needs to request parameters (the order details parameter uses ase256 (encrypted data) algorithm for encrypted transmission, and the signature data parameters use rsa2048 and sha256 algorithms for double encrypted transmission).

Secondly, the old rule is to write the code directly. After understanding that the above interface interaction requires encrypted data transmission, you must write the corresponding encryption algorithm tool class.

So, the solution to the problem of sm4 pad block corrupted is very simple. After reading Stack Overflow, we understand that we need to replace the JCE policy file in JAVA (due to import control restrictions in some countries, Java releases There are certain restrictions on encryption and decryption in the running environment package. For example, AES encryption and decryption with 256-bit keys is not allowed by default. The solution is to modify the policy file). In JAVA, AES128 is supported by default. If you want to use AES256, you need to replace it. The following two files (local_policy.jar and US_export_policy.jar) are enough. Both files are included in the attachments and there is no need to download them again.

Then the replacement method:? **Replace these two jar packages directly in the JDK path you installed? %JDK_HOME%\jre\lib\security. ** can be easily solved.