check if stream wrapper is already registered to avoid warning
performance improvement, check configuration only if no private key exists

backport from https://github.com/owncloud/core/commit/72eaf2894a540bc9280e144ba493db7fcde07eac