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