I am currently upgrading bouncycastle jar in my project from 1.47 to 1.70. The upgrade went fine and 1.70 is working good encrypting and decrpyting the files. But when it comes to decrypting older version files, for instance, a file sample.txt encrypted in 1.47 version is not getting decrypted in 1.70. I am getting the exception as below. Have any of you come across this context. This is critical from business perspective because the business might use older encrypted files to decrypt when ever they want to. the version upgrade should not be a show stopper.
Exception trace
org.bouncycastle.openpgp.PGPException: Exception constructing key
at org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyConverter.getPrivateKey(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder$2.recoverSessionData(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyEncryptedData.getSessionKey(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyEncryptedData.getDataStream(Unknown Source)
at PGPNew.decryptFile(PGPNew.java:212)
at PGPNew.main(PGPNew.java:146)
Caused by: java.security.NoSuchProviderException: no such provider: BC
at java.base/sun.security.jca.GetInstance.getService(GetInstance.java:83)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
at java.base/java.security.KeyFactory.getInstance(KeyFactory.java:225)
at org.bouncycastle.jcajce.util.NamedJcaJceHelper.createKeyFactory(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.OperatorHelper.createKeyFactory(Unknown Source)
at org.bouncycastle.openpgp.operator.jcajce.JcaPGPKeyConverter.implGeneratePrivate(Unknown Source)
your text
I tried to setup a stand alone progrom for both the versions 1.47 and 1.70. I generated my own pair of keys. Tried to decrypt 1.47 version encrypted file.