static void unregisterCNG(IEnumerable <Oid2> oid) { if (oid.Select(oid2 => new Wincrypt.CRYPT_OID_INFO { cbSize = Marshal.SizeOf(typeof(Wincrypt.CRYPT_OID_INFO)), pszOID = oid2.Value, pwszName = oid2.FriendlyName, dwGroupId = (Int32)oid2.OidGroup }).Any(oidinfo => !Crypt32.CryptUnregisterOIDInfo(oidinfo))) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }