protected override void OnLoad(SshDataWorker reader)
        {
            base.OnLoad(reader);

            if (MethodName != "publickey")
                throw new ArgumentException(string.Format("Method name {0} is not valid.", MethodName));

            HasSignature = reader.ReadBoolean();
            KeyAlgorithmName = reader.ReadString(Encoding.ASCII);
            PublicKey = reader.ReadBinary();

            if (HasSignature)
            {
                Signature = reader.ReadBinary();
                PayloadWithoutSignature = RawBytes.Take(RawBytes.Length - Signature.Length - 5).ToArray();
            }
        }
Beispiel #2
0
        protected override void OnLoad(SshDataWorker reader)
        {
            base.OnLoad(reader);

            if (MethodName != "publickey")
            {
                throw new ArgumentException(string.Format("Method name {0} is not valid.", MethodName));
            }

            HasSignature     = reader.ReadBoolean();
            KeyAlgorithmName = reader.ReadString(Encoding.ASCII);
            PublicKey        = reader.ReadBinary();

            if (HasSignature)
            {
                Signature = reader.ReadBinary();
                PayloadWithoutSignature = RawBytes.Take(RawBytes.Length - Signature.Length - 5).ToArray();
            }
        }
Beispiel #3
0
        protected override void OnLoad(SshDataWorker reader)
        {
            base.OnLoad(reader);

            if (this.MethodName != "publickey")
            {
                throw new ArgumentException($"Method name {this.MethodName} is not valid.");
            }

            this.HasSignature     = reader.ReadBoolean();
            this.KeyAlgorithmName = reader.ReadString(Encoding.ASCII);
            this.PublicKey        = reader.ReadBinary();

            if (!this.HasSignature)
            {
                return;
            }
            this.Signature = reader.ReadBinary();
            this.PayloadWithoutSignature = this.RawBytes.Take(this.RawBytes.Length - this.Signature.Length - 5).ToArray();
        }
        public byte[] GetSignature(byte[] signatureData)
        {
            Contract.Requires(signatureData != null);

            using (var worker = new SshDataWorker(signatureData))
            {
                if (worker.ReadString(Encoding.ASCII) != this.Name)
                    throw new CryptographicException("Signature was not created with this algorithm.");

                var signature = worker.ReadBinary();
                return signature;
            }
        }
        public byte[] GetSignature(byte[] signatureData)
        {
            Contract.Requires(signatureData != null);

            using (var worker = new SshDataWorker(signatureData)) {
                if (worker.ReadString(Encoding.ASCII) != this.Name)
                {
                    throw new CryptographicException("Signature was not created with this algorithm.");
                }

                var signature = worker.ReadBinary();
                return(signature);
            }
        }
Beispiel #6
0
 protected override void OnLoad(SshDataWorker reader)
 {
     Cookie = reader.ReadBinary(16);
     KeyExchangeAlgorithms               = reader.ReadString(Encoding.ASCII).Split(',');
     ServerHostKeyAlgorithms             = reader.ReadString(Encoding.ASCII).Split(',');
     EncryptionAlgorithmsClientToServer  = reader.ReadString(Encoding.ASCII).Split(',');
     EncryptionAlgorithmsServerToClient  = reader.ReadString(Encoding.ASCII).Split(',');
     MacAlgorithmsClientToServer         = reader.ReadString(Encoding.ASCII).Split(',');
     MacAlgorithmsServerToClient         = reader.ReadString(Encoding.ASCII).Split(',');
     CompressionAlgorithmsClientToServer = reader.ReadString(Encoding.ASCII).Split(',');
     CompressionAlgorithmsServerToClient = reader.ReadString(Encoding.ASCII).Split(',');
     LanguagesClientToServer             = reader.ReadString(Encoding.ASCII).Split(',');
     LanguagesServerToClient             = reader.ReadString(Encoding.ASCII).Split(',');
     FirstKexPacketFollows               = reader.ReadBoolean();
     Reserved = reader.ReadUInt32();
 }
 protected override void OnLoad(SshDataWorker reader)
 {
     Cookie = reader.ReadBinary(16);
     KeyExchangeAlgorithms = reader.ReadString(Encoding.ASCII).Split(',');
     ServerHostKeyAlgorithms = reader.ReadString(Encoding.ASCII).Split(',');
     EncryptionAlgorithmsClientToServer = reader.ReadString(Encoding.ASCII).Split(',');
     EncryptionAlgorithmsServerToClient = reader.ReadString(Encoding.ASCII).Split(',');
     MacAlgorithmsClientToServer = reader.ReadString(Encoding.ASCII).Split(',');
     MacAlgorithmsServerToClient = reader.ReadString(Encoding.ASCII).Split(',');
     CompressionAlgorithmsClientToServer = reader.ReadString(Encoding.ASCII).Split(',');
     CompressionAlgorithmsServerToClient = reader.ReadString(Encoding.ASCII).Split(',');
     LanguagesClientToServer = reader.ReadString(Encoding.ASCII).Split(',');
     LanguagesServerToClient = reader.ReadString(Encoding.ASCII).Split(',');
     FirstKexPacketFollows = reader.ReadBoolean();
     Reserved = reader.ReadUInt32();
 }
 protected override void OnLoad(SshDataWorker reader)
 {
     RecipientChannel = reader.ReadUInt32();
     Data             = reader.ReadBinary();
 }
 protected override void OnLoad(SshDataWorker reader)
 {
     RecipientChannel = reader.ReadUInt32();
     Data = reader.ReadBinary();
 }