去除sun.misc.BASE64Encoder依赖

This commit is contained in:
zhoubin 2021-08-10 16:36:10 +08:00
parent 881e3f6445
commit 73ad09279e

View File

@ -4,11 +4,11 @@ import com.sunyard.cert.X509;
import com.sunyard.proto.Util;
import racal.sunyard.main.SydApi4j;
import racal.sunyard.main.SydApiBuilder;
import sun.misc.BASE64Encoder;
import sun.security.provider.X509Factory;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Base64;
public class RSAP1SignVerify {
private static byte[] createBlock(byte type, byte[] in) {
@ -106,8 +106,8 @@ public class RSAP1SignVerify {
byte[] bSource = source.getBytes();
byte[] derCert = Util.decodeBase64(signCert);
BASE64Encoder encoder = new BASE64Encoder();
cert = X509Factory.BEGIN_CERT + "\n" + encoder.encodeBuffer(derCert) + X509Factory.END_CERT;
Base64.Encoder encoder = Base64.getEncoder();
cert = X509Factory.BEGIN_CERT + "\n" + encoder.encodeToString(derCert) + X509Factory.END_CERT;
X509 X509Cert = api.GetX509CertInfo(cert);
byte[] signature = Util.decodeBase64(signatureBase64);