MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / agent_key

Method agent_key

keepercommander/pedm/admin_plugin.py:198–209  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196
197 @property
198 def agent_key(self) -> bytes:
199 if self._agent_key is None:
200 enterprise = self.params.enterprise
201 tree_key = enterprise['unencrypted_tree_key']
202 encrypted_ec_private_key = utils.base64_url_decode(enterprise['keys']['ecc_encrypted_private_key'])
203 ec_private_key = crypto.decrypt_aes_v2(encrypted_ec_private_key, tree_key)
204
205 x1 = int.from_bytes(tree_key[:16], byteorder='big', signed=False)
206 x2 = int.from_bytes(tree_key[16:], byteorder='big', signed=False)
207 salt = (x1 ^ x2).to_bytes(length=16, byteorder='big', signed=False)
208 self._agent_key = crypto.derive_key_v1(utils.base64_url_encode(ec_private_key), salt, 1_000_000)
209 return self._agent_key
210
211 @property
212 def all_agents(self) -> bytes:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected