sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.19k stars 412 forks source link

BlumGoldwasser Incomplete Inheritance #18413

Open peterstory opened 9 years ago

peterstory commented 9 years ago

BlumGoldwasser doesn't properly inherit from its superclass, PublicKeyCryptosystem.

First, initialization is incomplete. The superclass of PublicKeyCryptosystem is Cryptosystem, whose initialization requires the arguments: plaintext_space, ciphertext_space, key_space, block_length, and period. These are not being supplied.

As a result, calls to the methods plaintext_space(), cipher_domain(), ciphertext_space(), cipher_codomain(), key_space(), block_length(), and period() fail. For example:

  sage: from sage.crypto.public_key.blum_goldwasser import BlumGoldwasser
  sage: bs = BlumGoldwasser()
  sage: bs.key_space()
  AttributeError: 'BlumGoldwasser' object has no attribute '_key_space'

The easiest solution would be to stop inheriting from PublicKeyCryptosystem.

CC: @kcrisman

Component: cryptography

Issue created by migration from https://trac.sagemath.org/ticket/18413

kcrisman commented 9 years ago
comment:1

Perhaps a naive question... is there anything else that uses PublicKeyCryptosystem?

peterstory commented 9 years ago
comment:2

BlumGoldwasser is actually the only module which uses PublicKeyCryptosystem. So it might be worth removing PublicKeyCryptosystem altogether. PublicKeyCryptosystem is defined on line 375 of crypto/cryptosystem.py.