Beispiel #1
0
        public OTRSession(string my_unique_id, string my_buddy_unique_id)
        {
            if (string.IsNullOrEmpty(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID cannot be null/empty");

            if (string.IsNullOrEmpty(my_buddy_unique_id))
                throw new ArgumentException("OTRSession:My buddy's unique ID cannot be null/empty");

            if (my_buddy_unique_id.Equals(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID and My buddy's unique ID cannot be the same value");

            _my_unique_id = my_unique_id;
            _my_buddy_unique_id = my_buddy_unique_id;

            _ake_keys_manager = new AKEKeysManager();
            _otr_session_object = new OTRSessionObjects();

            _dsa_signer = new DSASigner();
            _signature_manager = new SignatureManager(_dsa_signer);
        }
Beispiel #2
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();
        }
Beispiel #3
0
        public OTRSession(string my_unique_id, string my_buddy_unique_id, DSAKeyParams dsa_key_hex_strings, bool debug_mode)
        {
            if (dsa_key_hex_strings == null)
                throw new ArgumentException("OTRSession: The DSA key hex string object cannot be null");

            if (string.IsNullOrEmpty(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID cannot be null/empty");

            if (string.IsNullOrEmpty(my_buddy_unique_id))
                throw new ArgumentException("OTRSession:My buddy's unique ID cannot be null/empty");

            if (my_buddy_unique_id.Equals(my_unique_id))
                throw new ArgumentException("OTRSession:My uique ID and My buddy's unique ID cannot be the same value");

            _my_unique_id = my_unique_id;
            _my_buddy_unique_id = my_buddy_unique_id;

            _ake_keys_manager = new AKEKeysManager();
            _otr_session_object = new OTRSessionObjects();

            _dsa_signer = new DSASigner(dsa_key_hex_strings);
            _signature_manager = new SignatureManager(_dsa_signer);

            _debug_mode = debug_mode;
        }