Esempio n. 1
0
 public void SetSenderChainKey(ChainKey senderChainKey)
 {
     var chainKey = new Chain.ChainKey {
         key = senderChainKey.Key,
         index = senderChainKey.Index
     };
     Structure.SenderChain.chainKey = chainKey;
 }
Esempio n. 2
0
 public void SetReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey)
 {
     var chainAndIndex = GetReceiverChain(senderEphemeral);
     var chain = chainAndIndex.Item1;
     var chainKeyStructure = new Chain.ChainKey {
         key = chainKey.Key,
         index = (UInt32)chainKey.Index
     };
     chain.chainKey = chainKeyStructure;
 }
Esempio n. 3
0
        public void SetSenderChain(ECKeyPair senderRatchetKeyPair, ChainKey chainKey)
        {
            var chainKeyStructure = new Chain.ChainKey {
                key = chainKey.Key,
                index = (UInt32)chainKey.Index
            };

            var senderChain = new Chain {
                SenderRatchetKey = senderRatchetKeyPair.PublicKey.Serialize(),
                SenderRatchetKeyPrivate = senderRatchetKeyPair.PrivateKey.Serialize(),
                chainKey = chainKeyStructure
            };

            Structure.SenderChain = senderChain;
        }
Esempio n. 4
0
        public void AddReceiverChain(ECPublicKey senderRatchetKey, ChainKey chainKey)
        {
            var chainKeyStructure = new Chain.ChainKey {
                key = chainKey.Key,
                index = (UInt32)chainKey.Index
            };

            var chain = new Chain {
                chainKey = chainKeyStructure,
                SenderRatchetKey = senderRatchetKey.Serialize()
            };

            Structure.ReceiverChains.Add(chain);

            if(Structure.ReceiverChains.Count > 5)
            {
                Structure.ReceiverChains.RemoveAt(0);
            }
        }