exceptions.py 640 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
# coding=utf-8

# 
# (c) Chris von Csefalvay, 2015.

"""
exceptions is responsible for exception handling etc.
"""


class MalformedPublicKey(BaseException):
    """
    The public key is malformed as it does not meet the Legendre symbol criterion. The key might have been tampered with or might have been damaged in transit.
    """

    def __str__(self):
        return "Public key malformed: fails Legendre symbol verification."


class RNGError(BaseException):
    """
    Thrown when RNG could not be obtained.
    """

    def __str__(self):
        return "RNG could not be obtained. This module currently only works with Python 3."