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.
Solution:
The value in raw contains all the requested parameters.
The @RequestBody is also required, otherwise it will not receive the value it should.
back-end:
@Encrypt
@GetMapping("/encrypt")
public Student encrypt(){
Student stu = new Student();
stu.setId(1);
stu.setName("test");
return stu;
}
@Decrypt
@PostMapping("/decrypt")
public String testDecrypt(@RequestBody String username){
System.out.println(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:
- [Solved] Crypto-JS Failed to Decrypt Error: Uncaught Error: Malformed UTF-8 data
- RSA Decryption Error: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
- crypto-js Error: Malformed UTF-8 data [How to Solve]
- Solution to javax.naming.noinitialcontextexception error
- [Solved] Minio Error: javax.xml.stream.XMLStreamException: ParseError
- [Solved] nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
- [Solved] No validator could be found for constraint ‘javax.validation.constraints.NotBlank’ validating type ‘java.lang.String’
- Error resolution: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/Datatype
- [Solved] IDEA Add maven Project Error: Error:(3,21)java: Package javax.servletdoes not exist
- [Solved] JAVA Project Import jstl Error: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
- [Solved] Log4j2 log startup error: javax.xml.parsers.ParserConfigurationException…
- [Solved] javax.servlet.ServletException: Servlet[springmvc] Servlet.init()
- I/O error while reading input message; nested exception is java.io.IOException: Stream closed
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testApplicat
- Using Post no Body Error: socket hang up [How to Solve]
- Explicit and implicit conversion of Java data type
- Xdoc generates API documents based on Java annotations
- [PROJECT] itdage java to get the weather and send text messages
- [Solved] Hibernate Error: java.lang.StackOverflowError at java.lang.Integer.toString(Integer.java:402)
- Ternary operator in Java?: error: not a statement