static void registerCNG(Oid oid, OidGroupEnum group) { Wincrypt.CRYPT_OID_INFO oidinfo = new Wincrypt.CRYPT_OID_INFO { cbSize = Marshal.SizeOf(typeof(Wincrypt.CRYPT_OID_INFO)), pszOID = oid.Value, pwszName = oid.FriendlyName, dwGroupId = (Int32)@group }; if (!Crypt32.CryptRegisterOIDInfo(oidinfo, 0)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }