[Solved] javax.crypto.BadPaddingException: Decryption error

javax.crypto.BadPaddingException: Decryption error

When using RSA encrypt body spring boot for decryption. This error occurred

I access the interface in postman. As follows:

This error appears.


The value in raw contains all the requested parameters.

The @RequestBody is also required, otherwise it will not receive the value it should.


    public Student encrypt(){
        Student stu = new Student();
        return stu;

    public String testDecrypt(@RequestBody String username){
        return username;

The correct postman is as follows:

At this time, pay attention to the data format of the transfer. There may be a problem with submitting the wrong data type. Text is not necessarily right. After that problem, I changed to JSON.

Read More: