This returns that path of the private key if a key directory is set. It doesn't check whether the file exists.

@return string|null
161704
public function getPrivateKeyPath() {
		if($keyDir = $this->getKeyDir()) {
			$filter = FileNameFilter::create();
			$name = $filter->filter($this->Name);

			return $this->getKeyDir() . '/' . $name;
		}
		return null;
	}
1353101
public function getPrivateKey()
    {
        if ("---" !== substr($this->privateKey, 0, 3) && is_file($this->privateKey)) {
            $this->privateKey = file_get_contents($this->privateKey);
        }

        $key = new RSA();

        if ($password = $this->getPassword()) {
            $key->setPassword($password);
        }

        $key->loadKey($this->privateKey);

        return $key;
    }
1048481
public function get($key)
    {
        if (!$this->has($key)) {
            return null;
        }

        $file = $this->directory . substr(md5($this->prefix() . $key), 0, 10) . '.dat';

        return unserialize(file_get_contents($file));
    }
438691
public function getBuildPath()
    {
        $path = pathinfo($this->relativePath);

        $fingerprint = md5($this->filters->map(function($f) { return $f->getFilter(); })->toJson().$this->getLastModified());

        return "{$path['dirname']}/{$path['filename']}-{$fingerprint}.{$this->getBuildExtension()}";
    }
1195410
protected function getFilepath(string $key):string{
		$h = hash('sha256', $key);

		return $this->cachedir.$h[0].DIRECTORY_SEPARATOR.$h[0].$h[1].DIRECTORY_SEPARATOR.$h;
	}
923501
private function getDirectoryPath()
    {
        $path = $this->config['directory'];

        // Create directory if not exists
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        return $path . DIRECTORY_SEPARATOR;
    }
1114352
public function getFullPath()
    {
        if ($this->Filename) {
            return DMS::inst()->getStoragePath() . DIRECTORY_SEPARATOR
                . $this->Folder . DIRECTORY_SEPARATOR . $this->Filename;
        }

        return null;
    }
882117
protected function _securityKey($path = null) {
		if (empty($path)) {
			return false;
		}

		$oFile = new File($path . 'Config' . DS . 'core.php');
		if (!$oFile->exists()) {
			return false;
		}

		$contents = $oFile->read();
		$key = '';
		for ($i = 0; $i < 2; $i++) {
			$key .= substr(Security::generateAuthKey(), 0, 32);
		}

		return $this->_writeConfigCore(
			$path,
			'Configure::write(\'Security.key\', \'%s\')',
			$key,
			'A random numeric string (digits only) used to encrypt/decrypt strings.'
		);
	}
741927
public function getKey(): string
    {
        if ($this->key === null) {
            $this->key = md5($this->getContent());
        }
        return $this->key;
    }
825132
private function _get_path()
    {

        if (empty($this->file) && is_string($this->file)) return false;

        if (strpos($this->file, '/') !== false) {
            $path = explode('/', $this->file);
            array_pop($path);
            $this->path = (string)implode('/', $path) . '/';
        } elseif (strpos('\\', $this->file) !== false) {
            $path = explode('\\', $this->file);
            array_pop($path);
            $this->path = (string)implode('\\', $path) . '\\';
        } else {
            $this->path = getcwd() . '/';
        }

        return true;
    }
206090
protected function getStoragePath()
    {
        if ($override = $this->input->getOption('path')) {
            return $override;
        }
        $config = $this->getConfig();

        return getcwd().'/'.$config->path;
    }
1309225
private function getFilePath()
    {
        $fullName = $this->fullName;
        if (substr($fullName, 0, 1) != '/') {
            $fullName = '/' . $fullName;
        }
        return $this->getSetting('storePath') . $fullName;
    }
1158705
public function toFilePath(): string
    {
        if (!strlen((string)$this->partition)) {
            return str_replace(':', '/', $this->id);
        }

        $hash = md5($this->partition);
        return trim(sprintf(
            '%s/%s/%s/%s/%s',
            $this->topic,
            substr($hash, 0, 2),
            substr($hash, 2, 2),
            $this->partition,
            $this->subPartition
        ), '/');
    }
930662
public function getSPcert()
    {
        $cert = null;

        if (isset($this->_sp['x509cert']) && !empty($this->_sp['x509cert'])) {
            $cert = $this->_sp['x509cert'];
        } else {
            $certFile = $this->_paths['cert'].'sp.crt';

            if (file_exists($certFile)) {
                $cert = file_get_contents($certFile);
            }
        }
        return $cert;
    }
789468
public function setKey()
    {
        $path = $this->path . "/.cache_key";
        $key = bin2hex(openssl_random_pseudo_bytes(6));
        $umask = umask($this->umask);
        file_put_contents($path, $key);
        umask($umask);
        return $key;
    }
691183
public function get_path()
    {
        $cache_path = rtrim($this->params['path'], '/')
            .'/client'.'.'.$this->params['client_id'];

        foreach (func_get_args() as $arg) {
            $cache_path .= '.'.$arg;
        }

        return $cache_path;
    }
1011934
public function getSystemKey()
    {
        return isset($this->encryptedKeys[self::SYSTEM_IDENTIFIER])
            ? $this->encryptedKeys[self::SYSTEM_IDENTIFIER]
            : null;
    }