Exemplo n.º 1
0
        private Pair <StorageProtos.SessionStructure.Types.Chain, uint> GetReceiverChain(IEcPublicKey senderEphemeral)
        {
            IList <StorageProtos.SessionStructure.Types.Chain> receiverChains = _sessionStructure.ReceiverChainsList;
            uint index = 0;

            foreach (StorageProtos.SessionStructure.Types.Chain receiverChain in receiverChains)
            {
                try
                {
                    IEcPublicKey chainSenderRatchetKey = Curve.DecodePoint(receiverChain.SenderRatchetKey.ToByteArray(), 0);

                    if (chainSenderRatchetKey.Equals(senderEphemeral))
                    {
                        return(new Pair <StorageProtos.SessionStructure.Types.Chain, uint>(receiverChain, index));
                    }
                }
                catch (InvalidKeyException e)
                {
                    Debug.WriteLine(e.ToString(), "SessionRecordV2");
                }

                index++;
            }

            return(null);
        }
Exemplo n.º 2
0
        public override bool Equals(Object other)
        {
            if (other == null)
            {
                return(false);
            }
            if (!(other is IdentityKey))
            {
                return(false);
            }

            return(_publicKey.Equals(((IdentityKey)other).GetPublicKey()));
        }