Luzifer / go-openssl

go-openssl is a small library wrapping the crypto/aes functions in a way the output is compatible to OpenSSL
Apache License 2.0
122 stars 33 forks source link

Possible to decrypt "PBEWITHSHA256AND256BITAES-CBC-BC" #24

Closed the-hotmann closed 2 years ago

the-hotmann commented 2 years ago

I got a PBEWITHSHA256AND256BITAES-CBC-BC encrypted string, which is encrypted with:

  1. passwort
  2. salt
  3. iteration count (1000)

I know all this:

  1. encrypted string
  2. passwort
  3. salt
  4. iteration count
  5. what the plaintext is

Is this module able to decrypt this encrypted string to plaintext again?

Best regards!

Luzifer commented 2 years ago

If you can use OpenSSL (openssl enc -aes-256-cbc ...) to decrypt that string this library should be able to handle it too.

A quick search how to handle PBEWITHSHA256AND256BITAES-CBC-BC with OpenSSL yielded no useful results… What exactly is generating the encrypted data? Is that compatible to openssl enc?

the-hotmann commented 2 years ago

The encrypted data in generated with some java tool to store the strings encrypted. I assume it is a BouncyCastles encryption. Nope, aes-256-cbc is not working. Thanks anyway :)

Probably something like this: https://stackoverflow.com/questions/13684602/encrypt-decrypt-with-aes-and-salt-size-of-32 but I was searching for a golang based solution.

Luzifer commented 2 years ago

Nope, aes-256-cbc is not working. Thanks anyway :)

In that case this library is sadly not the tool of your choice… But I'm sure there must be something living somewhere in Github doing this as many results a search for PBEWITHSHA256AND256BITAES-CBC-BC yielded…