updated factory creation when both keystore present and insecure is true