Heavy refactoring: Windows workaround for >= 4k (4096 bit) client-cert SSL keys and...
authorMichael Schuster <michael@schuster.ms>
Tue, 24 Dec 2019 06:12:54 +0000 (07:12 +0100)
committerMichael Schuster <48932272+misch7@users.noreply.github.com>
Tue, 24 Dec 2019 06:47:35 +0000 (07:47 +0100)
commit9b034a2eb02a4d12c6561b783b7685748b09a65e
treef655d02fb069fcb3905db67c236fff152f186b54
parentbd9652b24c0674be224e1a94bc0bae09364fdc3a
Heavy refactoring: Windows workaround for >= 4k (4096 bit) client-cert SSL keys and large certs

With QtKeychain on Windows, storing larger keys or certs in one keychain entry causes the
following error due to limits in the Windows APIs:
    Error: "Credential size exceeds maximum size of 2560"

This fix implements the new wrapper class KeychainChunk with wrapper jobs ReadJob and WriteJob
to encapsulate the QKeychain handling of ReadPasswordJob and WritePasswordJob with binaryData
but split every supplied keychain entry's data into 2048 byte chunks, on Windows only.

The wrapper is used for all keychain operations in WebFlowCredentials, except for the server password.

All finished keychain jobs now get deleted properly, to avoid memory leaks.

For reference also see previous fixes:
- https://github.com/nextcloud/desktop/pull/1389
- https://github.com/nextcloud/desktop/pull/1394

This should finally fix the re-opened issue:
- https://github.com/nextcloud/desktop/issues/863

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/CMakeLists.txt
src/gui/creds/keychainchunk.cpp [new file with mode: 0644]
src/gui/creds/keychainchunk.h [new file with mode: 0644]
src/gui/creds/webflowcredentials.cpp
src/gui/creds/webflowcredentials.h