You could use the following lines:
// Remove Adobe's Rights enable dictionary
doc.GetRoot().Erase("Perm");
Obj view_prefs = doc.GetRoot().FindObj("ViewerPreferences");
if (view_prefs != null) view_prefs.Erase("Rights");
...
doc.Save(...)
Working now just a minor typo in your code needed to be
doc.GetRoot().Erase("Perms");