Exemple #1
0
        public void SetServerKeys(ChatSetupHeader header, KeyPair oneTimeKey)
        {
            this.publicEphemeralKey = header.publicEphemeralKey;
            this.publicPreKey       = header.publicPreKey;
            // test the ident key to be the same;

            if (this.publicIdentKey != null && this.publicIdentKey.Length != 0 && !this.publicIdentKey.SequenceEqual(header.publicIdentKey))
            {
                throw new Exception("Attack on e2e:/wrong ident key");
            }
            this.publicIdentKey = header.publicIdentKey;
            this.oneTimeKeyPair = oneTimeKey;
            this.isServer       = true;
        }
Exemple #2
0
        public ChatSetupHeader GetSessionSetupHeaders()
        {
            ChatSetupHeader header = new ChatSetupHeader();

            if (ephemeralKeyPair != null)
            {
                header.publicEphemeralKey = ephemeralKeyPair.publicKey;
            }
            header.publicIdentKey = ownIdentKeyPair.publicKey;
            header.publicPreKey   = ownPreKeyPair.publicKey;
            if (publicOneTimeKey != null)
            {
                header.publicOneTimeKey = this.publicOneTimeKey;
            }
            return(header);
        }