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