How to use the padding.RSAOracleWorker.RSATask function in Padding

To help you get started, we’ve selected a few Padding examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmgr / pybleach / padding.py View on Github external
def __parse_task(self, task):
    """ Returns a task as an RSATask object
    >>> o = Oracle()
    >>> def callback(*args):
    ...   return True
    >>> inq, outq = mp.Queue(), mp.Queue()
    >>> worker = RSAOracleWorker(o, callback, inq, outq, 123456, 0x10001)
    >>> worker._RSAOracleWorker__parse_task((1,2,3,4,5)) == None
    True
    >>> worker._RSAOracleWorker__parse_task((1,2,3,4)) # doctest: +ELLIPSIS
    <....RSATask object ...
    >>> inq.close()
    >>> outq.close()
    """
    try:
      new_task = RSAOracleWorker.RSATask(task)
    except ValueError:
      new_task = None
    return new_task