/// <inheritdoc /> public SecureString RetrieveOrPromptAndAddPasswordToRegistry(PasswordRegistryTypes passwordType, string promptMessage = null) { var password = RetrieveOrPromptPassword(passwordType, promptMessage ?? $"Please enter your {passwordType.Name}"); if (password != null) { _passwordRegistry.AddItemToRegistry(passwordType, password); } return(password); }
public SecureString PreloadPassword(string password = null) { _passwordRegistry.RemoveItemFromRegistry(PasswordRegistryTypes.DefaultNodePassword); SecureString secureStr = null; if (string.IsNullOrEmpty(password)) { return(null); } secureStr = new SecureString(); foreach (var c in password) { secureStr.AppendChar(c); } _passwordRegistry.AddItemToRegistry(PasswordRegistryTypes.DefaultNodePassword, secureStr); return(secureStr); }