我正在尝试使用 RSA 公钥和私钥解密和加密消息。
当我尝试阅读时,PGPObjectFactory.nextObject()我得到null 下面是我的代码。
Security.addProvider(new BouncyCastleProvider());
InputStream in = PGPUtil.getDecoderStream(new ByteArrayInputStream(encryptedString.getBytes()));
JcaPGPObjectFactory pgpFact;
PGPObjectFactory pgpF = new PGPObjectFactory(in, new JcaKeyFingerprintCalculator());
Object o = pgpF.nextObject(); // I get this null
PGPEncryptedDataList encList;
if(o instanceof PGPEncryptedDataList)
{
encList = (PGPEncryptedDataList) o;
}else {
encList = (PGPEncryptedDataList) pgpF.nextObject();
}
Iterator<PGPPublicKeyEncryptedData> itt = encList.getEncryptedDataObjects();
相同的代码正在运行java 1.8,但在 java 1.7 中运行时会出现此问题,
我正在使用所有充气城堡1.63
紫衣仙女
相关分类