public static void DecryptByteArray(ref byte[] byteArray) { try { if (Globals.MemoryEncryption == true && byteArray != null) { byteArray = SealedPublicKeyBox.Open(byteArray, _keyPair); } } catch (Exception ex) when(ExceptionFilters.MemoryEncryptionExceptions(ex)) { Logging.LogException(ex.ToString(), Logging.Severity.Bug); DisplayMessage.Error(ex.GetType().Name, "Memory decryption failed. This is a bug - please report it."); } }
public static void EncryptByteArray(ref byte[] byteArray) { try { if (Globals.MemoryEncryption == true && byteArray != null) { byteArray = SealedPublicKeyBox.Create(byteArray, _keyPair.PublicKey); } } catch (Exception ex) when(ExceptionFilters.MemoryEncryptionExceptions(ex)) { Globals.MemoryEncryption = false; KryptorSettings.SaveSettings(); Logging.LogException(ex.ToString(), Logging.Severity.Bug); DisplayMessage.Error(ex.GetType().Name, "Memory encryption has been disabled due to an exception. This is a bug - please report it."); } }