protected void sendNextKey(PublicKey key) throws IOException {
try {
log.info("Send SSH_MSG_USERAUTH_REQUEST for publickey");
Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_USERAUTH_REQUEST, 0);
int pos1 = buffer.wpos() - 1;
buffer.putString(username);
buffer.putString(service);
buffer.putString("publickey");
buffer.putByte((byte) 1);
buffer.putString((key instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);