@ringmaster It's not like the caching would not be possible. It should just not happen in getOpenSSLPkey(). Since theses are all global functions (a static method of a class is basically a global function with a fancy name), the proper way to do this is to hand over all dependency when calling the function (proper object oriented design also allows for passing dependencies in the constructor).

In this case, the checkConfiguration() function should depend on a new private/public key pair, which btw. is weird to begin with. I mean, why do you need a new key if you want to do operations with an existing key pair? RSA key generation involves finding big primes, so this costs quite a bit of CPU resources.

I see how doing this properly is kind of non-trivial given all the global state that is used everywhere throughout this app and ownCloud itself.