Hello im got stuck at ctf crypto challenge, so at the challenge is given 3 file which is

flag.enc pub.key priv.key

, so i tried to decrypt using openssl here is my command

openssl pkeyutl -decrypt -in flag.enc -inkey priv.key

. But it get an error with this message `

Public Key operation error 40870E30C87F0000:error:0200009F:rsa routines:RSA_padding_check_PKCS1_type_2:pkcs decoding error:../crypto/rsa/rsa_pk1.c:269: 40870E30C87F0000:error:02000072:rsa routines:rsa_ossl_private_decrypt:padding check failed:../crypto/rsa/rsa_ossl.c:499:`

Maybe my command is wrong, but im confused, what should i do with the public key?

  • $\begingroup$ You have "padding check failed". This may mean that after applying textbook RSA decryption, the result is not as expected. Look at the nice manual where it mentions RSA padding mode; and perhaps, independently, where it explains how to get a hex dump of the output data. The point is that you learn how to find what to do. $\endgroup$
    – fgrieu
    Mar 26 at 13:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.