-2
$\begingroup$

I have a

  • 1024-bits modulus n,
  • the key d which is 1022 bit long,
  • public exponent 65537,
  • two factor p and q,
  • and the ciphertext y 1023 bits which is all in numbers.

How can we perform decryption and work out the plaintext? I have tried CrypTool, tried entering the key d, two factor p and q, but it always give me an error saying

Output block size = 127 is too small must be 128

$\endgroup$
1
  • $\begingroup$ The output size is the (minimum) size of the modulus in bytes. So you could enter 128 and then simply ignore the leftmost bit. $\endgroup$
    – Maarten Bodewes
    May 21, 2023 at 16:16

1 Answer 1

1
$\begingroup$

Being that you have all of the necessary ingredients (p, q, n, d, and e) as integers, you can use rsatool to create a .pem file containing the private key in PEM format.

Then, you can use openssl rsautil -decrypt to decrypt the ciphertext, using the private key in PEM format. See https://www.openssl.org/docs/man3.0/man1/openssl-rsautl.html for more info.

Note that openssl operates on raw bytes. You say that you have ciphertext y 1023 bits which is all in numbers, so you may need to convert these number to bytes for openssl to operate on.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.