Solve the issue by caching the key in the temporary file with unique name. Then search for the key in the directory and match the key with the cert and store them in proxycert.pem file.