verif.init(key, null);
buffer.wpos(oldLim);
byte[] sig = hasSig ? buffer.getBytes() : null;
PublickeyAuthenticator authenticator = session.getServerFactoryManager().getPublickeyAuthenticator();
if (authenticator == null) {
throw new Exception("No PublickeyAuthenticator configured");
}
if (!hasSig) {
if (authenticator.hasKey(username, key, session)) {
Buffer buf = session.createBuffer(SshConstants.Message.SSH_MSG_USERAUTH_PK_OK);
buf.putString(alg);
buf.putRawBytes(buffer.array(), oldPos, 4 + len);
session.writePacket(buf);
return null;
} else {
throw new Exception("Unsupported key for user");
}
} else {
if (!authenticator.hasKey(username, key, session)) {
throw new Exception("Unsupported key for user");
}
Buffer buf = new Buffer();
buf.putString(session.getKex().getH());
buf.putCommand(SshConstants.Message.SSH_MSG_USERAUTH_REQUEST);