- 微信公钥加密敏感信息方法问题
public static String rsaEncryptOAEP(String message, String publicKey) throws IllegalBlockSizeException, IOException { try { Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); cipher.init(Cipher.ENCRYPT_MODE, publicKey); byte[] data = message.getBytes("utf-8"); byte[] cipherdata = cipher.doFinal(data); return Base64.getEncoder().encodeToString(cipherdata); } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { throw new RuntimeException("当前Java环境不支持RSA v1.5/OAEP", e); } catch (InvalidKeyException e) { throw new IllegalArgumentException("无效的公钥", e); } catch (IllegalBlockSizeException | BadPaddingException e) { throw new IllegalBlockSizeException("加密原串的长度不能超过214字节"); } } 想问下在使用微信支付公钥加密敏感信息的时候,微信官方的文档里面 cipher.init(Cipher.ENCRYPT_MODE, publicKey) init方法是支持publicKey传入一个字符串的,我复制到代码中之后 这个init方法是不支持publicKey是一个字符串的,必须是KEY类型的参数,想问下这是我包用的不对吗
2024-12-09 - 调用微信支付的最新的sdk那个client是无需关注加签和验签呢
调用微信支付的最新的sdk那个client是无需关注加签和验签呢
2024-12-06 - 下载平台证书出现404
[图片]上面配置了微信平台申请的证书的私钥,以及证书序列号,这里去下载证书返回404,notfound请问是什么原因呢,同样的代码使用其他的证书就可以下载
2024-12-05