public void setSenderChainKey(ChainKey nextChainKey) { Chain.Types.ChainKey chainKey = new Chain.Types.ChainKey { Key = ByteString.CopyFrom(nextChainKey.getKey()), Index = nextChainKey.getIndex() }; sessionStructure.SenderChain.ChainKey = chainKey; }
public void setSenderChainKey(ChainKey nextChainKey) { Chain.Types.ChainKey chainKey = Chain.Types.ChainKey.CreateBuilder() .SetKey(ByteString.CopyFrom(nextChainKey.getKey())) .SetIndex(nextChainKey.getIndex()) .Build(); Chain chain = sessionStructure.SenderChain.ToBuilder() .SetChainKey(chainKey).Build(); this.sessionStructure = this.sessionStructure.ToBuilder().SetSenderChain(chain).Build(); }
public void setSenderChain(ECKeyPair senderRatchetKeyPair, ChainKey chainKey) { Chain.Types.ChainKey chainKeyStructure = Chain.Types.ChainKey.CreateBuilder() .SetKey(ByteString.CopyFrom(chainKey.getKey())) .SetIndex(chainKey.getIndex()) .Build(); Chain senderChain = Chain.CreateBuilder() .SetSenderRatchetKey(ByteString.CopyFrom(senderRatchetKeyPair.getPublicKey().serialize())) .SetSenderRatchetKeyPrivate(ByteString.CopyFrom(senderRatchetKeyPair.getPrivateKey().serialize())) .SetChainKey(chainKeyStructure) .Build(); this.sessionStructure = this.sessionStructure.ToBuilder().SetSenderChain(senderChain).Build(); }
public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey) { Pair <Chain, uint> chainAndIndex = getReceiverChain(senderEphemeral); Chain chain = chainAndIndex.first(); Chain.Types.ChainKey chainKeyStructure = new Chain.Types.ChainKey { Key = ByteString.CopyFrom(chainKey.getKey()), Index = chainKey.getIndex() }; chain.ChainKey = chainKeyStructure; sessionStructure.ReceiverChains[(int)chainAndIndex.second()] = chain; }
public void setReceiverChainKey(ECPublicKey senderEphemeral, ChainKey chainKey) { Pair <Chain, uint> chainAndIndex = getReceiverChain(senderEphemeral); Chain chain = chainAndIndex.first(); Chain.Types.ChainKey chainKeyStructure = Chain.Types.ChainKey.CreateBuilder() .SetKey(ByteString.CopyFrom(chainKey.getKey())) .SetIndex(chainKey.getIndex()) .Build(); Chain updatedChain = chain.ToBuilder().SetChainKey(chainKeyStructure).Build(); this.sessionStructure = this.sessionStructure.ToBuilder() .SetReceiverChains((int)chainAndIndex.second(), updatedChain) // TODO: conv .Build(); }
public void setSenderChain(ECKeyPair senderRatchetKeyPair, ChainKey chainKey) { Chain.Types.ChainKey chainKeyStructure = new Chain.Types.ChainKey { Key = ByteString.CopyFrom(chainKey.getKey()), Index = chainKey.getIndex() }; Chain senderChain = new Chain { SenderRatchetKey = ByteString.CopyFrom(senderRatchetKeyPair.getPublicKey().serialize()), SenderRatchetKeyPrivate = ByteString.CopyFrom(senderRatchetKeyPair.getPrivateKey().serialize()), ChainKey = chainKeyStructure }; this.sessionStructure.SenderChain = senderChain; }
public void addReceiverChain(ECPublicKey senderRatchetKey, ChainKey chainKey) { Chain.Types.ChainKey chainKeyStructure = Chain.Types.ChainKey.CreateBuilder() .SetKey(ByteString.CopyFrom(chainKey.getKey())) .SetIndex(chainKey.getIndex()) .Build(); Chain chain = Chain.CreateBuilder() .SetChainKey(chainKeyStructure) .SetSenderRatchetKey(ByteString.CopyFrom(senderRatchetKey.serialize())) .Build(); this.sessionStructure = this.sessionStructure.ToBuilder().AddReceiverChains(chain).Build(); if (this.sessionStructure.ReceiverChainsList.Count > 5) { this.sessionStructure = this.sessionStructure.ToBuilder() /*.ClearReceiverChains()*/.Build(); //RemoveReceiverChains(0) TODO: why does it work without } }
public void addReceiverChain(ECPublicKey senderRatchetKey, ChainKey chainKey) { Chain.Types.ChainKey chainKeyStructure = Chain.Types.ChainKey.CreateBuilder() .SetKey(ByteString.CopyFrom(chainKey.getKey())) .SetIndex(chainKey.getIndex()) .Build(); Chain chain = Chain.CreateBuilder() .SetChainKey(chainKeyStructure) .SetSenderRatchetKey(ByteString.CopyFrom(senderRatchetKey.serialize())) .Build(); sessionStructure = sessionStructure.ToBuilder().AddReceiverChains(chain).Build(); if (sessionStructure.ReceiverChainsList.Count > 5) { sessionStructure = sessionStructure.ToBuilder().Build(); } }
public void addReceiverChain(ECPublicKey senderRatchetKey, ChainKey chainKey) { Chain.Types.ChainKey chainKeyStructure = new Chain.Types.ChainKey { Key = ByteString.CopyFrom(chainKey.getKey()), Index = chainKey.getIndex() }; Chain chain = new Chain { ChainKey = chainKeyStructure, SenderRatchetKey = ByteString.CopyFrom(senderRatchetKey.serialize()) }; this.sessionStructure.ReceiverChains.Add(chain); while (this.sessionStructure.ReceiverChains.Count > 5) { this.sessionStructure.ReceiverChains.RemoveAt(0); //TODO why was here a TODO? } }
public ChainKey getSenderChainKey() { Chain.Types.ChainKey chainKeyStructure = sessionStructure.SenderChain.ChainKey; return(new ChainKey(HKDF.createFor(getSessionVersion()), chainKeyStructure.Key.ToByteArray(), chainKeyStructure.Index)); }