org.bouncycastle.pkcs.PKCSException

See original GitHub issue

Describe the bug

i use permUtil to load the perm certificate, a Exception was thrown

To Reproduce

X509ExtendedKeyManager keyManager = PemUtils.parseIdentityMaterial(certificate.getCertificate(), certificate.getPrivateKey(), certificate.getPassphrase().toCharArray());

the error is

Caused by: org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: Wrong algorithm: AES or Rijndael required
	at org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo.decryptPrivateKeyInfo(Unknown Source)
	at nl.altindag.ssl.decryptor.BouncyFunction.lambda$andThen$0(BouncyFunction.java:22)
	at nl.altindag.ssl.util.PemUtils.extractPrivateKeyInfo(PemUtils.java:493)
	... 55 common frames omitted
Caused by: org.bouncycastle.operator.OperatorCreationException: 1.2.840.113549.1.5.13 not available: Wrong algorithm: AES or Rijndael required
	at org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder$1.get(Unknown Source)
	... 58 common frames omitted
Caused by: java.security.InvalidKeyException: Wrong algorithm: AES or Rijndael required
	at com.sun.crypto.provider.AESCrypt.init(AESCrypt.java:83)
	at com.sun.crypto.provider.CipherBlockChaining.init(CipherBlockChaining.java:93)
	at com.sun.crypto.provider.CipherCore.init(CipherCore.java:591)
	at com.sun.crypto.provider.CipherCore.init(CipherCore.java:619)
	at com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:355)
	at javax.crypto.Cipher.implInit(Cipher.java:810)
	at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
	at javax.crypto.Cipher.init(Cipher.java:1539)
	at javax.crypto.Cipher.init(Cipher.java:1470)
	... 59 common frames omitted

JDK version: Java™ SE Runtime Environment (build 1.8.0_131-b11) System: Ubuntu SMP Fri Aug 10 11:14:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

however this is ok when using jdk1.8.0_291.jdk

what should i do when using jdk 1.8.0_131-b11?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lijianlcommented, Apr 20, 2022

i have find a way to deal this: looks like 128bit or 256 bit problem

  1. download https://www.oracle.com/java/technologies/javase-jce8-downloads.html#license-lightbox
  2. replace the same jar in ${home}/jdk1.8.0_131.jdk/Contents/Home/jre/lib/security

but i still busying with finding the way to solve this with code rather than update jar in jdk.

as for code way, i think you guys are better at with code

0reactions
Hakky54commented, Apr 23, 2022

Awesome, really nice to hear that we were able to solve this issue! It was nice debugging it, have a nice day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PKCSException (Bouncy Castle Library 1.71 API Specification)
public class PKCSException extends java.lang.Exception. General checked Exception thrown in the cert package and its sub-packages. See Also: Serialized Form ...
Read more >
org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo
This page shows Java code examples of org.bouncycastle.pkcs. ... CertificateException, OperatorCreationException, PKCSException { Security.
Read more >
org.bouncycastle.pkcs.PKCSException Maven / Gradle / Ivy
The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.5...
Read more >
Java Examples for org.bouncycastle.pkcs.PKCSException
This java examples will help you to understand the usage of org.bouncycastle.pkcs.PKCSException. These source code samples are taken from different open ...
Read more >
How to decrypt a pkcs8 encrypted private key using bouncy ...
org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: No such provider: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found