Saturday, July 15, 2017

Weirdness with openSSL and Bouncy Castle

I spent most of the day trying to figure out why a private key wasn't loading only to find out that openSSL was behaving strangely.

I shouldn't put all the blame on openSSL, I was trying to use Bouncy Castle.

The problem appears to be that a file began with

-----BEGIN RSA PRIVATE KEY-----

instead of this

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,913379F68EA66ADB

I would think that Bouncy Castle would detect this but apparently, I'm wrong.

Instead Bouncy Castle continues on its merry way, until it tries to get the decryption algorithm, at which point it throws the following exception:

org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: unknown algorithm

Hence, my wasted day.

No comments:

Post a Comment

The release date for Miranda is now 9/30/2018