Beispiel #1
0
def DecryptHash(key, ciphertext):
    """Decrypt a hash with a private key."""
    encrypted = base64.b64decode(ciphertext)
    plaintext = key.decrypt(compat.stringToBytes(encrypted))
    if plaintext:
        return compat.bytesToString(plaintext)
    else:
        # decryption failed
        return None
Beispiel #2
0
def DecryptHash(key, ciphertext):
  """Decrypt a hash with a private key."""
  encrypted = base64.b64decode(ciphertext)
  plaintext = key.decrypt(compat.stringToBytes(encrypted))
  if plaintext:
    return compat.bytesToString(plaintext)
  else:
    # decryption failed
    return None
Beispiel #3
0
def filter(packetNo, data, source, target):
    bytes = stringToBytes(data)
    if packetNo == 0 and 'Client2Server' in str(source):
        pass
    elif packetNo == 1 and 'Client2Server' not in str(source):
        print "server says hello"
        print bytes
        
    result = bytesToString(bytes)
    target.write(result)
    return result