Message builder for the agent forwarding response. (OpenSSH's protocol)
상속: ISSH1PacketBuilder, ISSH2PacketBuilder
예제 #1
0
        /// <summary>
        /// List SSH2 keys
        /// </summary>
        private void SSH2Identities()
        {
            var authKeys = _authKeyProvider.GetAvailableSSH2UserAuthKeys() ?? new SSH2UserAuthKey[0];
            var message  = new OpenSSHAgentForwardingMessage(OpenSSHAgentForwardingMessageType.SSH2_AGENT_IDENTITIES_ANSWER);

            message.WriteInt32(authKeys.Length);
            foreach (var key in authKeys)
            {
                byte[] blob = key.GetPublicKeyBlob();
                message.WriteAsString(blob);
                message.WriteUTF8String(key.Comment);
            }
            Send(message);
        }
예제 #2
0
        /// <summary>
        /// List SSH1 RSA keys
        /// </summary>
        private void SSH1Identities()
        {
            var authKeys = _authKeyProvider.GetAvailableSSH1UserAuthKeys() ?? new SSH1UserAuthKey[0];
            var message  = new OpenSSHAgentForwardingMessage(OpenSSHAgentForwardingMessageType.SSH_AGENT_RSA_IDENTITIES_ANSWER);

            message.WriteInt32(authKeys.Length);
            foreach (var key in authKeys)
            {
                message.WriteInt32(key.PublicModulus.BitCount());
                SSH1PacketBuilderMixin.WriteBigInteger(message, key.PublicExponent);
                SSH1PacketBuilderMixin.WriteBigInteger(message, key.PublicModulus);
                message.WriteString(key.Comment);
            }
            Send(message);
        }
예제 #3
0
 /// <summary>
 /// Sends a message.
 /// </summary>
 /// <param name="message">a message object</param>
 private void Send(OpenSSHAgentForwardingMessage message)
 {
     _channel.Send(message.GetImage());
 }
예제 #4
0
 /// <summary>
 /// List SSH2 keys
 /// </summary>
 private void SSH2Identities()
 {
     var authKeys = _authKeyProvider.GetAvailableSSH2UserAuthKeys() ?? new SSH2UserAuthKey[0];
     var message = new OpenSSHAgentForwardingMessage(OpenSSHAgentForwardingMessageType.SSH2_AGENT_IDENTITIES_ANSWER);
     message.WriteInt32(authKeys.Length);
     foreach (var key in authKeys) {
         byte[] blob = key.GetPublicKeyBlob();
         message.WriteAsString(blob);
         message.WriteUTF8String(key.Comment);
     }
     Send(message);
 }
예제 #5
0
 /// <summary>
 /// List SSH1 RSA keys
 /// </summary>
 private void SSH1Identities()
 {
     var authKeys = _authKeyProvider.GetAvailableSSH1UserAuthKeys() ?? new SSH1UserAuthKey[0];
     var message = new OpenSSHAgentForwardingMessage(OpenSSHAgentForwardingMessageType.SSH_AGENT_RSA_IDENTITIES_ANSWER);
     message.WriteInt32(authKeys.Length);
     foreach (var key in authKeys) {
         message.WriteInt32(key.PublicModulus.BitCount());
         SSH1PacketBuilderMixin.WriteBigInteger(message, key.PublicExponent);
         SSH1PacketBuilderMixin.WriteBigInteger(message, key.PublicModulus);
         message.WriteString(key.Comment);
     }
     Send(message);
 }
예제 #6
0
 /// <summary>
 /// Sends a message.
 /// </summary>
 /// <param name="message">a message object</param>
 private void Send(OpenSSHAgentForwardingMessage message)
 {
     _channel.Send(message.GetImage());
 }