Credit card model cannot save credit card numbers of irregular length

Issue #71 resolved
Daniel Blankenberg created an issue

The credit card model in payment/models.py uses a block cipher to encrypt the number before writing to the database. The cipher requires input to be a length that is a multiple of 8. Although most cc numbers are 16 long these days there are numbers that are not multiples of 8 long. In this case, the encryption object throws an unhandled exception from storeCC().

The attached patch pads the cc number to an 8 byte multiple before encryption, and strips the padding when decrypting.

Comments (1)

  1. Chris Moffitt repo owner

    I had to make a minor change to the patch but it has been included as of [481]

    Thanks Dan.

  2. Log in to comment