xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #946: crypto-log.patch

File crypto-log.patch, 1.8 KB (added by Antoine Martin, 6 years ago)

enables logging for the encryption and decryption of raw packet data (for debugging)

  • xpra/net/crypto.py

     
    1919
    2020
    2121def get_iv():
    22     IV = None
    23     #IV = "0000000000000000"
     22    #IV = None
     23    IV = "0000000000000000"
    2424    return IV or get_hex_uuid()[:16]
    2525
    2626def get_salt():
    27     KEY_SALT = None
    28     #KEY_SALT = "0000000000000000"
     27    #KEY_SALT = None
     28    KEY_SALT = "0000000000000000"
    2929    return KEY_SALT or (get_hex_uuid()+get_hex_uuid())
    3030
    3131def get_iterations():
  • xpra/net/protocol.py

     
    328328                data = self.cipher_out.encrypt(padded)
    329329                assert len(data)==actual_size, "expected encrypted size to be %i, but got %i" % (len(data), actual_size)
    330330                log("sending %s bytes %s encrypted with %s padding", payload_size, self.cipher_out_name, padding_size)
     331                log("%s(%s)=%s", self.cipher_out_name, repr_ellipsized(padded), binascii.hexlify(data))
    331332            if proto_flags & FLAGS_NOHEADER:
    332333                assert not self.cipher_out
    333334                #for plain/text packets (ie: gibberish response)
     
    743744                if self.cipher_in and protocol_flags & FLAGS_CIPHER:
    744745                    log("received %i %s encrypted bytes with %s padding", payload_size, self.cipher_in_name, padding_size)
    745746                    data = self.cipher_in.decrypt(raw_string)
     747                    log("%s(%s)=%s", self.cipher_in_name, binascii.hexlify(raw_string), repr_ellipsized(data))
    746748                    if padding_size > 0:
    747749                        def debug_str(s):
    748750                            try: