Copy the key into a temporary file.