private function extractKeyAndIV(PhabricatorFile $file) { $outer_iv = $file->getStorageProperty('iv.base64'); $outer_iv = base64_decode($outer_iv); $outer_iv = new PhutilOpaqueEnvelope($outer_iv); $outer_payload = $file->getStorageProperty('payload.base64'); $outer_payload = base64_decode($outer_payload); $outer_key_name = $file->getStorageProperty('key.name'); $outer_key = $this->getMasterKeyMaterial($outer_key_name); $payload = $this->decryptData($outer_payload, $outer_key, $outer_iv); $payload = phutil_json_decode($payload); $inner_iv = $payload['iv.base64']; $inner_iv = base64_decode($inner_iv); $inner_iv = new PhutilOpaqueEnvelope($inner_iv); $inner_key = $payload['key.base64']; $inner_key = base64_decode($inner_key); $inner_key = new PhutilOpaqueEnvelope($inner_key); return array($inner_key, $inner_iv); }