加解密遇到的JCE cannot authenticate the provider BC问题解决方案

前言

相信搞过加解密的同学大部分都会遇到过这个问题——JCE cannot authenticate the provider BC
笔者最近在做一个亚马逊的项目需要进行GPG加解密,因为测试jar包是亚马逊提供的,jar是经过签名的,咱也不能修改,所以只能修改自己的JDK配置

分析

在解密时错误日志如下:

Exception in thread "main" java.lang.IllegalArgumentException: Could not decrypt the provided file, please check that provided keys are correct and in the format as specified in tech spec.Exception decrypting key
	at com.amazon.psp.datavalidation.file.FileUtils.getDataAsStream(FileUtils.java:37)
	at com.amazon.psp.datavalidation.entrypoint.MainClass.main(MainClass.java:22)
Caused by: org.bouncycastle.openpgp.PGPException: Exception decrypting key
	at org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source)
	at org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(Unknown Source)
	at org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(Unknown Source)
	at org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(Unknown Source)
	at com.amazon.psp.datavalidation.pgp.PgpDecryptionHelper.decryptAndVerifySignature(PgpDecryptionHelper.java:68)
	at com.amazon.psp.datavalidation.file.FileUtils.getDataAsStream
评论 13
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值