예제 #1
0
        public bool Write(AlternativeCompositeByteBuf buffer, Message message, ISignatureCodec signatureCodec)
        {
            Message = message;
            Logger.Debug("Message for outbound {0}.", message);

            if (!_header)
            {
                MessageHeaderCodec.EncodeHeader(buffer, message);
                _header = true;
            }
            else
            {
                Logger.Debug("Send a follow-up message {0}.", message);
                _resume = true;
            }

            bool done = Loop(buffer);

            Logger.Debug("Message encoded {0}.", message);

            // write out what we have
            if (buffer.IsReadable && done)
            {
                // check if message needs to be signed
                if (message.IsSign)
                {
                    // we sign if we did not provide a signature already
                    if (signatureCodec == null)
                    {
                        signatureCodec = _signatureFactory.Sign(message.PrivateKey, buffer);
                    }
                    // in case of relay, we have a signature, so we need to resuse this
                    signatureCodec.Write(buffer);
                }
            }

            return(done);
        }
예제 #2
0
 public Message SetReceivedSignature(ISignatureCodec signatureEncode)
 {
     ReceivedSignature = signatureEncode;
     return this;
 }
예제 #3
0
 public bool Verify(IPublicKey publicKey, ByteBuf buffer, ISignatureCodec signatureEncoded)
 {
     throw new NotImplementedException();
 }
예제 #4
0
 public Message SetReceivedSignature(ISignatureCodec signatureEncode)
 {
     ReceivedSignature = signatureEncode;
     return(this);
 }
예제 #5
0
파일: Data.cs 프로젝트: lanicon/TomP2P.NET
 public Data SetSignature(ISignatureCodec signature)
 {
     Signature = signature;
     return(this);
 }