Merge remote-tracking branch 'origin/1.0.11.SNAPSHOT' into 1.0.11.SNAPSHOT

This commit is contained in:
felord
2021-05-25 12:38:42 +08:00

View File

@@ -30,9 +30,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.util.AlternativeJdkIdGenerator; import org.springframework.util.*;
import org.springframework.util.Base64Utils;
import org.springframework.util.IdGenerator;
import org.springframework.web.client.RestOperations; import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponents;
@@ -256,6 +254,15 @@ public class SignatureProvider {
* @return the string * @return the string
*/ */
public String decryptResponseBody(String tenantId, String associatedData, String nonce, String ciphertext) { public String decryptResponseBody(String tenantId, String associatedData, String nonce, String ciphertext) {
try {
Assert.hasText(associatedData, "associatedData is invalid");
Assert.hasText(nonce, "nonce is invalid");
Assert.hasText(ciphertext, "ciphertext is invalid");
} catch (Exception e) {
throw new PayException(e.getMessage());
}
try { try {
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", BC_PROVIDER); Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", BC_PROVIDER);
String apiV3Key = wechatMetaContainer.getWechatMeta(tenantId).getV3().getAppV3Secret(); String apiV3Key = wechatMetaContainer.getWechatMeta(tenantId).getV3().getAppV3Secret();