I have the following groovy script:

cmd1 = "echo ${really_long_key}"
ssl_cmd = "openssl aes-256-cbc -md md5 -nosalt -a -pass pass:${encryptPassword} dec" 

def process = cmd1.execute() | ssl_cmd.execute()

It works for smaller keys, but if the key is 2900+ characters, it fails to decrypt.

Also, if done on the command line like (echo "really_long_key" | openssl aes-..... I end up with the follwong error:

bad decrypt 140150542661448:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:evp_enc.c:589:

Why does decryption fail with overly long keys?

  • Can you give an example where it works? What version of openssl are you using? Why are you using openssl's command line tools for this in the first place (you probably shouldn't)? – AndrolGenhald May 9 at 15:03
  • Using the same script with shorter keys work. I am not that skilled and have got this in my lap. So it might be better solutions available. – bjornb May 10 at 11:37
  • Can you edit your question to include both a working example and a broken example? – AndrolGenhald May 10 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.