I'm happy to remove it if its of questionable security, but it saves literally half the load time (3 seconds) from an initial key generation request, because the code in play first calls this method to see if it *can* use this function to create the key, then calls the function again to do so. In each page load, this method is executed only once under conditions other than the creation of a key (because the key file already exists) and seems pretty benign to me. This is why I was asking for feedback --  although I'd prefer not to throw out the efficiency out of hand, it may be prudent to trace it to ensure it is safe to use in this way.  A this point it may be simpler to make the load time doubled to ensure safety and save extensive review for later. I was hoping someone knowledgable would chime in on this issue to say explicitly yes or no, but otherwise we can err on the side if safety.

On Tuesday, August 20, 2013 at 4:01 PM, Björn Schießle wrote:

> In apps/files_encryption/lib/helper.php:
> > @@ -249,6 +249,29 @@ public static function checkConfiguration() { > } > > /** > + * Create an openssl pkey with config-supplied settings > + * @return resource The pkey resource created > + */ > + public static function getOpenSSLPkey() { > + static $res = null; > + if (is_null($res)) { > + $res = openssl_pkey_new(self::getOpenSSLConfig());  
> I don't insist on doing it this way. I just say that it shouldn't be a problem with respect to the app and with the valid pre-condition that every user can only have one unique key pair... Let's see what @ringmaster (https://github.com/ringmaster) says, maybe he will suggest another solution.
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/owncloud/core/pull/4514/files#r5868928).
>  
>  
>