RSA encryption/decryption doesn't restore original value when given message starts with 0

Create issue
Issue #98 resolved
Takashi Kato repo owner created an issue

This should return #vu8(0 0 0 1)

(import (rnrs)
    (crypto))

(define keypair (generate-key-pair RSA))

(define msg #vu8(0 0 0 1))

(let ((enc-ci (cipher RSA (keypair-public keypair) :padding #f))
      (dec-ci (cipher RSA (keypair-private keypair) :padding #f)))
  (decrypt dec-ci (encrypt enc-ci msg)))

But return s #vu8(0)

Comments (2)

  1. Takashi Kato reporter

    Bouncy Castle returns #vu8(1) with nopadding. This seems kind of inevitable. All what we can do is that ensuring to return proper value when padding is specified. Thus it should also return #vu8(1) if it's not padded.

  2. Log in to comment