# File lib/net/ssh/authentication/agent.rb, line 118
118:     def sign(key, data)
119:       type, reply = send_and_wait(SSH2_AGENT_SIGN_REQUEST, :string, Buffer.from(:key, key), :string, data, :long, 0)
120: 
121:       if agent_failed(type)
122:         raise AgentError, "agent could not sign data with requested identity"
123:       elsif type != SSH2_AGENT_SIGN_RESPONSE
124:         raise AgentError, "bad authentication response #{type}"
125:       end
126: 
127:       return reply.read_string
128:     end