public void UpdateChat(EncryptedChatConstructor chat, byte[] a) { Deployment.Current.Dispatcher.BeginInvoke(() => { var dialogsEnum = from dialog in session.Dialogs.Model.Dialogs where dialog is DialogModelEncrypted && ((DialogModelEncrypted)dialog).Id == chat.id select(DialogModelEncrypted) dialog; List <DialogModelEncrypted> dialogs = dialogsEnum.ToList(); if (dialogs.Count != 1) { logger.error("invalid target encrypted dialogs count: {0}"); } foreach (var dialogModel in dialogs) { dialogModel.SetEncryptedChat(chat, a); } }); }
public void SetEncryptedChat(EncryptedChatConstructor chat, byte[] a) { this.chat = chat; OnPropertyChanged("IsWaiting"); if (a != null) { this.a = a; } if (this.a != null) { logger.info("computation key based on a: {0} and m: {1}", BitConverter.ToString(this.a).Replace("-", "").ToLower(), TelegramSession.Instance.EncryptedChats.Modulo); key = new BigInteger(1, chat.g_a_or_b).ModPow(new BigInteger(1, this.a), TelegramSession.Instance.EncryptedChats.Modulo).ToByteArrayUnsigned(); fingerprint = EncryptedChats.CalculateKeyFingerprint(key); this.a = null; logger.info("new calculated key: {0}", BitConverter.ToString(key).Replace("-", "").ToLower()); } // TODO: on property changed }
public void SetEncryptedChat(EncryptedChatConstructor chat, byte[] a) { this.chat = chat; OnPropertyChanged("IsWaiting"); if(a != null) { this.a = a; } if(this.a != null) { logger.info("computation key based on a: {0} and m: {1}", BitConverter.ToString(this.a).Replace("-", "").ToLower(), TelegramSession.Instance.EncryptedChats.Modulo); key = new BigInteger(1, chat.g_a_or_b).ModPow(new BigInteger(1, this.a), TelegramSession.Instance.EncryptedChats.Modulo).ToByteArrayUnsigned(); fingerprint = EncryptedChats.CalculateKeyFingerprint(key); this.a = null; logger.info("new calculated key: {0}", BitConverter.ToString(key).Replace("-", "").ToLower()); } // TODO: on property changed }
public void UpdateChat(EncryptedChatConstructor chat, byte[] a) { Deployment.Current.Dispatcher.BeginInvoke(() => { var dialogsEnum = from dialog in session.Dialogs.Model.Dialogs where dialog is DialogModelEncrypted && ((DialogModelEncrypted)dialog).Id == chat.id select (DialogModelEncrypted)dialog; List<DialogModelEncrypted> dialogs = dialogsEnum.ToList(); if(dialogs.Count != 1) { logger.error("invalid target encrypted dialogs count: {0}"); } foreach (var dialogModel in dialogs) { dialogModel.SetEncryptedChat(chat, a); } }); }