Exemple #1
0
        public void OnEvent(object source, OTREventArgs e)
        {
            switch (e.GetOTREvent())
            {
                case OTR_EVENT.MESSAGE:

                    break;

                case OTR_EVENT.SEND:

                    break;
                case OTR_EVENT.ERROR:

                    break;
                case OTR_EVENT.READY:

                    break;
                case OTR_EVENT.DEBUG:

                    break;
                case OTR_EVENT.EXTRA_KEY_REQUEST:


                    break;
                case OTR_EVENT.SMP_MESSAGE:

                    break;
                case OTR_EVENT.CLOSED:

                    break;

            }
        }
Exemple #2
0
        private void OTRSessionEventHandler(object source, OTREventArgs e)
        {
            try
            {
                OnOTREvent(this, e);


                if (/*e.GetOTREvent() == OTR_EVENT.ERROR ||*/ e.GetOTREvent() == OTR_EVENT.CLOSED)
                {
                    DeleteOTRSession(e.GetSessionID());
                }
            }
            catch
            {
            }
        }
Exemple #3
0
        public void RequestOTRSession(string my_buddy_unique_id, string otr_version)
        {
            if (string.IsNullOrEmpty(otr_version) == true)
            {
                throw new ArgumentException("RequestOTRSession: The OTR version string cannot be null/empty");
            }


            if (IsSessionRegistered(my_buddy_unique_id) == false)
            {
                throw new ArgumentException("RequestOTRSession: my buddy unique id does not exist");
            }

            OTR_VERSION _otr_version = Utility.GetOTRVersion(otr_version);


            if (_otr_version == OTR_VERSION.INVALID)
            {
                throw new ArgumentException("RequestOTRSession: OTR version is invalid");
            }

            string _otr_version_string = string.Empty;

            if (_otr_version == OTR_VERSION.VERSION_2)
            {
                _otr_version_string = OTRConstants.OTR_VERSION_2;
            }
            else if (_otr_version == OTR_VERSION.VERSION_3)
            {
                _otr_version_string = OTRConstants.OTR_VERSION_3;
            }

            OTREventArgs _event_args = new OTREventArgs();

            _event_args.SetMessage(_otr_version_string);
            _event_args.SetOTREvent(OTR_EVENT.SEND);
            _event_args.SetSessionID(my_buddy_unique_id);

            OnOTREvent(this, _event_args);
        }
Exemple #4
0
 private void OnAliceOTRMangerEventHandler(object source, OTREventArgs e)
 {
     switch (e.GetOTREvent())
     {
         case OTR_EVENT.MESSAGE:
             log.Items.Add(String.Format("{0}: {1} \n", e.GetSessionID(), e.GetMessage()));
             if (_alice_convo_pos < _alice_convo_array.Length)
             {
                 _alice_convo_pos++;
                 _alice_otr_session_manager.EncryptMessage(_alice_my_buddy_unique_id, _alice_convo_array[_alice_convo_pos - 1]);
             }
             break;
         case OTR_EVENT.SEND:
             SendDataOnNetwork(_alice_unique_id, e.GetMessage());
             break;
         case OTR_EVENT.ERROR:
             log.Items.Add(String.Format("Alice: OTR Error: {0} \n", e.GetErrorMessage()));
             log.Items.Add(String.Format("Alice: OTR Error Verbose: {0} \n", e.GetErrorVerbose()));
             break;
         case OTR_EVENT.READY:
             log.Items.Add(String.Format("Alice: Encrypted OTR session with {0} established \n", e.GetSessionID()));
             _alice_convo_pos++;
             _alice_otr_session_manager.EncryptMessage(_alice_my_buddy_unique_id, _alice_convo_array[_alice_convo_pos - 1]);
             break;
         case OTR_EVENT.DEBUG:
             log.Items.Add(String.Format("Alice: " + e.GetMessage() + "\n"));
             break;
         case OTR_EVENT.EXTRA_KEY_REQUEST:
             break;
         case OTR_EVENT.SMP_MESSAGE:
             log.Items.Add(String.Format("Alice: " + e.GetMessage() + "\n"));
             break;
         case OTR_EVENT.CLOSED:
             log.Items.Add(String.Format("Alice: Encrypted OTR session with {0} closed \n", e.GetSessionID()));
             break;
     }
 }
Exemple #5
0
        private void OTRSessionEventHandler(object source, OTREventArgs e)
        {
            try
            {
                OnOTREvent(this, e);

                if (/*e.GetOTREvent() == OTR_EVENT.ERROR ||*/ e.GetOTREvent() == OTR_EVENT.CLOSED)
                {
                    DeleteOTRSession(e.GetSessionID());

                }

            }
            catch
            {

            }
        }
Exemple #6
0
        private void SendError(string error_message)
        {
            error_message = OTRConstants.OTR_ERROR + error_message;

            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetMessage(error_message);
            _otr_event_args.SetOTREvent(OTR_EVENT.SEND);
            DoOTREvent(_otr_event_args);
        }
Exemple #7
0
        private void OTRError(string error_string, string verbose_string, string remote_error_string)
        {
            if (string.IsNullOrEmpty(remote_error_string) == false)
                SendError(remote_error_string);

            if (string.IsNullOrEmpty(verbose_string) == true)
                verbose_string = error_string;

            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);
            _otr_event_args.SetErrorVerbose(verbose_string);
            _otr_event_args.SetErrorMessage(error_string);
            DoOTREvent(_otr_event_args);

            // CloseOTRSession("Session closed as a result of OTR error");
        }
Exemple #8
0
        public void RequestOTRSession(string my_buddy_unique_id, string otr_version)
        {
            if (string.IsNullOrEmpty(otr_version) == true)
                throw new ArgumentException("RequestOTRSession: The OTR version string cannot be null/empty");

            if (IsSessionRegistered(my_buddy_unique_id) == false)
             throw new ArgumentException("RequestOTRSession: my buddy unique id does not exist");

            OTR_VERSION _otr_version = Utility.GetOTRVersion(otr_version);

            if (_otr_version == OTR_VERSION.INVALID)
                throw new ArgumentException("RequestOTRSession: OTR version is invalid");

            string _otr_version_string = string.Empty;

            if (_otr_version == OTR_VERSION.VERSION_2)
                _otr_version_string = OTRConstants.OTR_VERSION_2;
            else if (_otr_version == OTR_VERSION.VERSION_3)
                _otr_version_string = OTRConstants.OTR_VERSION_3;

            OTREventArgs _event_args = new OTREventArgs();
            _event_args.SetMessage(_otr_version_string);
            _event_args.SetOTREvent(OTR_EVENT.SEND);
            _event_args.SetSessionID(my_buddy_unique_id);

            OnOTREvent(this, _event_args);
        }
Exemple #9
0
        private void DebugPrint(string debug_text)
        {
            if (_debug_mode == false)
                return;

            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetOTREvent(OTR_EVENT.DEBUG);
            _otr_event_args.SetMessage(debug_text);
            DoOTREvent(_otr_event_args);
        }
Exemple #10
0
        private void DoOTREvent(OTREventArgs event_args)
        {
            if (event_args == null)
                return;

            try
            {

                event_args.SetSessionID(_my_buddy_unique_id);
                OnOTREvent(this, event_args);
            }
            catch
            {

            }
        }
Exemple #11
0
        private void SendOTRMessage(byte[] message_data)
        {
            if (message_data == null || message_data.Length < 1)
                throw new ArgumentException("SendOTRMessage: The message byte array to be sent cannot be null/empty");

            try
            {
                _data_to_send = SetHeaderFooter(message_data);

                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage(_data_to_send);
                _otr_event_args.SetOTREvent(OTR_EVENT.SEND);
            }
            catch (Exception ex)
            {

                _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);
                _otr_event_args.SetErrorVerbose("SendOTRMessage:" + ex.ToString());
                _otr_event_args.SetErrorMessage("SendOTRMessage:Internal OTR error");

            }

            DoOTREvent(_otr_event_args);
        }
Exemple #12
0
        private void CloseOTRSession(string session_closed_message)
        {
            DebugPrint("Ending OTR session");

            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetMessage(session_closed_message);
            _otr_event_args.SetOTREvent(OTR_EVENT.CLOSED);
            DoOTREvent(_otr_event_args);

            _message_state = OTR_MESSAGE_STATE.MSG_STATE_PLAINTEXT;
            _message_manager = null;
            _ake_keys_manager = null;
            _dsa_signer = null;
            _signature_manager = null;
            _smp_manager = null;
            _ake_keys = null;
            _my_unique_id = string.Empty;
            _my_buddy_unique_id = string.Empty;
            _otr_fragment_object = null;
            EndSMPSession();
        }
Exemple #13
0
        private void ProcessDHKeyMessage(OTRMessage otr_message)
        {
            DebugPrint("Received DH Key Message");

            _otr_event_args = new OTREventArgs();

            if (_authentication_state != OTR_AUTH_STATE.AUTH_STATE_AWAITING_DH_KEY)
            {

                OTRError("ProcessDHKeyMessage: OTR Engine is not in the AUTH_STATE_AWAITING_DH_KEY state", "ProcessDHKeyMessage: OTR Engine is not in the AUTH_STATE_AWAITING_DH_KEY state",
                null);

                return;

            }

            if (otr_message.GetGxMpi() == null || otr_message.GetGxMpi().Length < 1)
            {
                OTRError("ProcessDHKeyMessage: The received MPI encoded public key byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                return;
            }

            if (_otr_session_object.IsSetBuddyFirstPublicKey(otr_message.GetGxMpi()) == false)
            {

                OTRError("ProcessDHKeyMessage:" + _my_buddy_unique_id + "'s DH public key is invalid",
                    "ProcessDHKeyMessage:" + _my_buddy_unique_id + "'s DH public key is invalid",
               "OTR Failed. Unexpected error");

                return;
            }

               _ake_keys = _ake_keys_manager.ComputeKeys(_otr_session_object.GetMyRecentDHKeyPair(), _otr_session_object.GetBuddyRecentPublicKey());

            _signature_manager.ComputeSignature(_ake_keys, _otr_session_object.GetMyRecentDHKeyPair().GetPublicKeyMpiBytes(), _otr_session_object.GetMyRecentDHKeyPair().GetKeyIDBytes(),
                 otr_message.GetGxMpi(), _otr_session_object.GetCounter(), true);

            if (_aes_key == null || _aes_key.Length < 1)
            {
                OTRError("ProcessDHKeyMessage: The AES key byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                return;
            }

            Utility.EncodeOTRDataBE(_aes_key, ref _temp_buffer);

            _temp_buffer_2 = new byte[_temp_buffer.Length + _signature_manager.GetSignatureDataLength()];

            Buffer.BlockCopy(_temp_buffer, 0, _temp_buffer_2, 0, _temp_buffer.Length);
            Buffer.BlockCopy(_signature_manager.GetSignatureDataBytes(), 0, _temp_buffer_2, _temp_buffer.Length, _signature_manager.GetSignatureDataLength());

            byte[] _dh_reveal_byte_array = _message_manager.FormatRevealSig(_temp_buffer_2);

            _authentication_state = OTR_AUTH_STATE.AUTH_STATE_AWAITING_SIG;

            DebugPrint("Sending Reveal Signature Message");
            SendOTRMessage(_dh_reveal_byte_array);
        }
Exemple #14
0
        private void SendOTRFragement(string fragment_string, UInt16 fragment_number, UInt16 total_number_of_fragments)
        {
            if (string.IsNullOrEmpty(fragment_string) == true)
                throw new ArgumentException("SendOTRFragement: The fragment string to be sent cannot be null/empty");

            if (fragment_number > total_number_of_fragments)
                throw new ArgumentException("SendOTRFragement: The fragment number cannot exceed the the total number of fragments");

            try
            {

                _data_to_send = SetFragmentHeaderFooter(fragment_string, fragment_number, total_number_of_fragments);
                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage(_data_to_send);
                _otr_event_args.SetOTREvent(OTR_EVENT.SEND);

            }
            catch (Exception ex)
            {

                _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);
                _otr_event_args.SetErrorVerbose("SendOTRFragement:" + ex.ToString());
                _otr_event_args.SetErrorMessage("SendOTRFragement:Internal OTR error");

            }

            DoOTREvent(_otr_event_args);
        }
Exemple #15
0
        private void ProcessTLVSMPMessage(byte[] smp_byte_data, OTR_TLV_TYPE tlv_type)
        {
            DebugPrint("Received SMP message with TLV of type " + tlv_type.ToString());

            _smp_event_type_1 = OTR_SMP_EVENT.INVALID;
            _smp_event_type_2 = OTR_SMP_EVENT.INVALID;
            _smp_message = string.Empty;

            StartSMPSession(false);

            byte[] _message_byte_array = null;
            byte[] _encoded_smp_bytes = _smp_manager.ProcessSMPMessage(smp_byte_data, tlv_type, ref _smp_event_type_1, ref _smp_event_type_2, ref _smp_message);

            if (_smp_event_type_2 == OTR_SMP_EVENT.SUCCEEDED)
            {
                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage("SMP completed succesfully");
                _otr_event_args.SetOTREvent(OTR_EVENT.SMP_MESSAGE);
                _otr_event_args.SetSMPEvent(OTR_SMP_EVENT.SUCCEEDED);

                DoOTREvent(_otr_event_args);

                EndSMPSession();

            }

            if ((_smp_event_type_1 == OTR_SMP_EVENT.SEND) &&
               (_encoded_smp_bytes != null && _encoded_smp_bytes.Length > 0))
            {
                _message_byte_array = FormatMessageWtTLV(null, _encoded_smp_bytes, null);

                if (_smp_max_fragement_length > 0)
                EncryptFragments(_message_byte_array, _smp_max_fragement_length);
                else
                    EncryptMessage(_message_byte_array, false);

            }

            else if (_smp_event_type_1 == OTR_SMP_EVENT.ABORT)
            {

                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage(_smp_message);
                _otr_event_args.SetOTREvent(OTR_EVENT.SMP_MESSAGE);
                _otr_event_args.SetSMPEvent(OTR_SMP_EVENT.ABORT);

                DoOTREvent(_otr_event_args);

                EndSMPSession();

            }

            else if (_smp_event_type_1 == OTR_SMP_EVENT.FAILED)
            {

                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage("Man in the middle attack suspected");
                _otr_event_args.SetOTREvent(OTR_EVENT.SMP_MESSAGE);
                _otr_event_args.SetSMPEvent(OTR_SMP_EVENT.FAILED);

                DoOTREvent(_otr_event_args);

                EndSMPSession();

            }
            else if (_smp_event_type_1 == OTR_SMP_EVENT.SUCCEEDED)
            {

                _otr_event_args = new OTREventArgs();
                _otr_event_args.SetMessage("SMP completed succesfully");
                _otr_event_args.SetOTREvent(OTR_EVENT.SMP_MESSAGE);
                _otr_event_args.SetSMPEvent(OTR_SMP_EVENT.SUCCEEDED);
                DoOTREvent(_otr_event_args);
                EndSMPSession();

            }
            else
            {
                DebugPrint("ProcessTLVSMPMessage:Invalid SMP event");
                EndSMPSession();

            }
        }
Exemple #16
0
        private void ProcessTLVSMPAbort(byte[] smp_abort_bytes)
        {
            DebugPrint("Abort SMP message was received from " + _my_buddy_unique_id);

            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetMessage("SMP aborted based on request from " + _my_buddy_unique_id);
            _otr_event_args.SetOTREvent(OTR_EVENT.SMP_MESSAGE);
            _otr_event_args.SetSMPEvent(OTR_SMP_EVENT.ABORT);

            DoOTREvent(_otr_event_args);
            EndSMPSession();
        }
Exemple #17
0
        private void ProcessSignatureMessage(OTRMessage otr_message)
        {
            DebugPrint("Received Signature Message");

            _otr_event_args = new OTREventArgs();

            if (_authentication_state != OTR_AUTH_STATE.AUTH_STATE_AWAITING_SIG)
            {

                OTRError("ProcessSignatureMessage: OTR Engine is not in the AUTH_STATE_AWAITING_SIG state",
                  "ProcessSignatureMessage: OTR Engine is not in the AUTH_STATE_AWAITING_SIG state",
                 null);

                return;

            }

            if (otr_message.GetEncodedEncryptedSignature() == null || otr_message.GetEncodedEncryptedSignature().Length < 1)
            {
                OTRError("ProcessSignatureMessage: The encoded encrypted signature byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                return;
            }

            if (otr_message.GetMacDSignature() == null || otr_message.GetMacDSignature().Length < 1)
              {
                    OTRError("ProcessSignatureMessage: The MAC'd signature byte array cannot be null/empty", null,
                        "OTR Failed. Unexpected error");
                    return;
                }

            _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);

            byte[] dsa_public_key_byte_array_encoded = null;

            bool _is_sig_verified = SignatureManager.IsSignatureVerified(_ake_keys, _otr_session_object.GetMyRecentDHKeyPair(), _otr_session_object.GetBuddyRecentPublicKeyMpi(),
                otr_message.GetEncodedEncryptedSignature(), otr_message.GetMacDSignature(), false, ref _temp_int_32_val, ref dsa_public_key_byte_array_encoded);

            if (_otr_session_object.IsComputeBuddyFingerPrint(dsa_public_key_byte_array_encoded) == false)
            {

                OTRError("ProcessSignatureMessage:" + _my_buddy_unique_id + "'s DSA public key fingerprint computation failed",
                 "ProcessSignatureMessage:" + _my_buddy_unique_id + "'s DSA public key fingerprint computation failed",
                 null);
                _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;
                return;
            }

            if (_is_sig_verified != true)
            {

                OTRError("ProcessSignatureMessage:" + _my_buddy_unique_id + "'s signature verification failed",
                    "ProcessSignatureMessage:" + _my_buddy_unique_id + "'s signature verification failed",
                    null);
                _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;
                return;
            }

            /* Inform client of OTR readiness  */
            _otr_session_object.SetFirstBuddyPublicKeyID(_temp_int_32_val);
            _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;
            _message_state = OTR_MESSAGE_STATE.MSG_STATE_ENCRYPTED;
            _otr_event_args.SetOTREvent(OTR_EVENT.READY);
            _otr_event_args.SetMessage(_my_buddy_unique_id + "'s signature verification successful");

            DoOTREvent(_otr_event_args);
        }
Exemple #18
0
        private void ProcessRevealSigMessage(OTRMessage otr_message)
        {
            DebugPrint("Received Reveal Signature Message");

            _otr_event_args = new OTREventArgs();

            if (_authentication_state != OTR_AUTH_STATE.AUTH_STATE_AWAITING_REVEAL_SIG)
            {
                OTRError("ProcessRevealSigMessage: OTR Engine is not in the AUTH_STATE_AWAITING_REVEAL_SIG state",
                  "ProcessRevealSigMessage: OTR Engine is not in the AUTH_STATE_AWAITING_REVEAL_SIG state",
             null);

                return;

            }

            if (otr_message.GetRevealedKey() == null || otr_message.GetRevealedKey().Length < 1)
            {
                OTRError("ProcessRevealSigMessage: The AES revealed key byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                 return;
            }

            if (otr_message.GetEncodedEncryptedSignature() == null || otr_message.GetEncodedEncryptedSignature().Length < 1)
            {
                OTRError("ProcessRevealSigMessage: The encoded encrypted signature byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                return;
            }

            if (otr_message.GetMacDSignature() == null || otr_message.GetMacDSignature().Length < 1)
            {
                OTRError("ProcessRevealSigMessage: The MAC'd signature byte array cannot be null/empty", null,
                    "OTR Failed. Unexpected error");
                return;
            }

            _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);

            if (_dh_commit_message == null || _dh_commit_message.GetEncryptedGxMpi() == null || _dh_commit_message.GetEncryptedGxMpi().Length < 1)
            {
                OTRError("ProcessRevealSigMessage: The MPI encoded encrypted public key (g^x mpi) should not be null/empty",
                  "ProcessRevealSigMessage: The MPI encoded encrypted public key (g^x mpi) should not be null/empty",
             "OTR Failed. Unexpected error");

                return;

            }

            if (_otr_session_object.IsSetMyBuddyFirstPublicKey(otr_message.GetRevealedKey(), _dh_commit_message.GetEncryptedGxMpi(),
                _dh_commit_message.GetHashedGxMpi()) == false)
            {

                OTRError("ProcessRevealSigMessage: The MPI encoded decrypted public key (g^x mpi) should not be null/empty",
                "ProcessRevealSigMessage: The MPI encoded decrypted public key (g^x mpi) should not be null/empty",
                "OTR Failed. Unexpected error");
                return;

            }

            _ake_keys = _ake_keys_manager.ComputeKeys(_otr_session_object.GetMyRecentDHKeyPair(), _otr_session_object.GetBuddyRecentPublicKey());

            byte[] dsa_public_key_byte_array_encoded = null;

            bool _is_sig_verified = SignatureManager.IsSignatureVerified(_ake_keys, _otr_session_object.GetMyRecentDHKeyPair(), _otr_session_object.GetBuddyRecentPublicKeyMpi(),
                otr_message.GetEncodedEncryptedSignature(), otr_message.GetMacDSignature(), true, ref _temp_int_32_val, ref dsa_public_key_byte_array_encoded);

            if (_otr_session_object.IsComputeBuddyFingerPrint(dsa_public_key_byte_array_encoded) == false)
            {

                OTRError("ProcessRevealSigMessage:" + _my_buddy_unique_id + "'s DSA public key fingerprint computation failed",
                 "ProcessRevealSigMessage:" + _my_buddy_unique_id + "'s DSA public key fingerprint computation failed",
                 null);
                _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;
                return;
            }

            if (_is_sig_verified != true)
            {

                OTRError("ProcessRevealSigMessage:" + _my_buddy_unique_id + "'s signature verification failed",
                   "ProcessRevealSigMessage:" + _my_buddy_unique_id + "'s signature verification failed",
                  "OTR Failed. Unexpected error");

                _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;

                return;
            }

            _signature_manager.ComputeSignature(_ake_keys, _otr_session_object.GetMyRecentDHKeyPair().GetPublicKeyMpiBytes(), _otr_session_object.GetMyRecentDHKeyPair().GetKeyIDBytes(),
               _otr_session_object.GetBuddyRecentPublicKeyMpi(), _otr_session_object.GetCounter(), false);

            //Send signature message
            byte[] _dh_signature_byte_array = _message_manager.FormatSignature(_signature_manager.GetSignatureDataBytes());

            DebugPrint("Sending Signature Message");
            SendOTRMessage(_dh_signature_byte_array);

            /* Inform client of OTR readiness  */
            _otr_session_object.SetFirstBuddyPublicKeyID(_temp_int_32_val);
            _authentication_state = OTR_AUTH_STATE.AUTH_STATE_NONE;
            _message_state = OTR_MESSAGE_STATE.MSG_STATE_ENCRYPTED;
            _otr_event_args.SetOTREvent(OTR_EVENT.READY);
            _otr_event_args.SetMessage(_my_buddy_unique_id + "'s signature verification successful");

            DoOTREvent(_otr_event_args);
        }
Exemple #19
0
        private void ProcessOTRError(string otr_message_string)
        {
            string _temp_string = otr_message_string.Substring(0, 11);
            _otr_event_args = new OTREventArgs();
            _otr_event_args.SetOTREvent(OTR_EVENT.ERROR);

            if (_temp_string.Equals(OTRConstants.OTR_ERROR) == false)
            {
                OTRError("ProcessOTRError: Received OTR message not properly formatted",
               "ProcessOTRError: Received OTR message not properly formatted", null);

            }
            else
            {

                _temp_string = otr_message_string.Substring(11, otr_message_string.Length - 11);

                if (!string.IsNullOrEmpty(_temp_string))
                    OTRError("ProcessOTRError: (Error Message from " + _my_buddy_unique_id + ") " + _temp_string,
                      "ProcessOTRError: (Error Message from " + _my_buddy_unique_id + ") " + _temp_string, null);

            }
        }