rework getFileSize

I have been rewriting getFileSize with the purpose of avoiding opening the encrypted file as an encrypted stream. I will need this to avoid recursion when I rework #8390 (to make the encrypted stream seekable the unencrypted filesize is required upon opening the stream).
I used the opportunity to make the procedure more robust for a number of exotic situation, such as local streams that are non-seekable or streams that return less than 8192 bytes upon fread. That should all be covered now.
I didn't do much testing yet. It seems to work on my installation. Any feedback appreciated.
We need to read the Cipher always this way. parseHeader() and getCipher() can handle the case if no header exists. If no header exists we always need to use the legacy cipher "AES-128-CFB" and not the cipher configured in config.php.