Avoid transmitting the currently un-needed enc_proto
This commit is contained in:
parent
78a5957863
commit
c07178f43a
@ -65,7 +65,6 @@ command is created and transmitted that contains the fields:
|
|||||||
"iv": "base85 encoded IV",
|
"iv": "base85 encoded IV",
|
||||||
"tag": "base85 encoded AEAD tag",
|
"tag": "base85 encoded AEAD tag",
|
||||||
"pubkey": "base85 encoded ECDH public key of sender",
|
"pubkey": "base85 encoded ECDH public key of sender",
|
||||||
"enc_proto": "The first field from KITTY_PUBLIC_KEY, currently always 1",
|
|
||||||
"encrypted": "The original command encrypted and base85 encoded"
|
"encrypted": "The original command encrypted and base85 encoded"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ def parse_cmd(serialized_cmd: str, encryption_key: EllipticCurveKey) -> Dict[str
|
|||||||
return {}
|
return {}
|
||||||
pcmd.pop('password', None)
|
pcmd.pop('password', None)
|
||||||
if 'encrypted' in pcmd:
|
if 'encrypted' in pcmd:
|
||||||
if pcmd.get('enc_proto') != RC_ENCRYPTION_PROTOCOL_VERSION:
|
if pcmd.get('enc_proto', '1') != RC_ENCRYPTION_PROTOCOL_VERSION:
|
||||||
log_error(f'Ignoring encrypted rc command with unsupported protocol: {pcmd.get("enc_proto")}')
|
log_error(f'Ignoring encrypted rc command with unsupported protocol: {pcmd.get("enc_proto")}')
|
||||||
return {}
|
return {}
|
||||||
pubkey = pcmd.get('pubkey', '')
|
pubkey = pcmd.get('pubkey', '')
|
||||||
@ -353,10 +353,13 @@ class CommandEncrypter:
|
|||||||
cmd['password'] = self.password
|
cmd['password'] = self.password
|
||||||
raw = json.dumps(cmd).encode('utf-8')
|
raw = json.dumps(cmd).encode('utf-8')
|
||||||
encrypted = encrypter.add_data_to_be_encrypted(raw, True)
|
encrypted = encrypter.add_data_to_be_encrypted(raw, True)
|
||||||
return {
|
ans = {
|
||||||
'version': version, 'iv': encode_as_base85(encrypter.iv), 'tag': encode_as_base85(encrypter.tag),
|
'version': version, 'iv': encode_as_base85(encrypter.iv), 'tag': encode_as_base85(encrypter.tag),
|
||||||
'pubkey': encode_as_base85(self.pubkey), 'encrypted': encode_as_base85(encrypted), 'enc_proto': self.encryption_version
|
'pubkey': encode_as_base85(self.pubkey), 'encrypted': encode_as_base85(encrypted),
|
||||||
}
|
}
|
||||||
|
if self.encryption_version != '1':
|
||||||
|
ans['enc_proto'] = self.encryption_version
|
||||||
|
return ans
|
||||||
|
|
||||||
def adjust_response_timeout_for_password(self, response_timeout: float) -> float:
|
def adjust_response_timeout_for_password(self, response_timeout: float) -> float:
|
||||||
return max(response_timeout, 120)
|
return max(response_timeout, 120)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user