use of org.apache.sshd.common.random.SingletonRandomFactory in project gerrit by GerritCodeReview.
the class SshDaemon method initProviderBouncyCastle.
private void initProviderBouncyCastle(Config cfg) {
NamedFactory<Random> factory;
if (cfg.getBoolean("sshd", null, "testUseInsecureRandom", false)) {
factory = new InsecureBouncyCastleRandom.Factory();
} else {
factory = SecurityUtils.getRandomFactory();
}
setRandomFactory(new SingletonRandomFactory(factory));
}
use of org.apache.sshd.common.random.SingletonRandomFactory in project karaf by apache.
the class KarafJaasAuthenticatorTest method init.
@Before
public void init() throws Exception {
configuration = Configuration.getConfiguration();
Configuration.setConfiguration(new Configuration() {
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
return new AppConfigurationEntry[] { new AppConfigurationEntry(SayYes.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, emptyMap()) };
}
});
final SshServer server = new SshServer();
IoHandler ioHandler = new IoHandler() {
@Override
public void sessionCreated(IoSession ioSession) throws Exception {
}
@Override
public void sessionClosed(IoSession ioSession) throws Exception {
}
@Override
public void exceptionCaught(IoSession ioSession, Throwable throwable) throws Exception {
}
@Override
public void messageReceived(IoSession ioSession, Readable readable) throws Exception {
}
};
IoProcessor ioProcessor = new IoProcessor() {
@Override
public boolean isDisposing() {
return false;
}
@Override
public boolean isDisposed() {
return false;
}
@Override
public void dispose() {
}
@Override
public void add(org.apache.mina.core.session.IoSession ioSession) {
}
@Override
public void flush(org.apache.mina.core.session.IoSession ioSession) {
}
@Override
public void write(org.apache.mina.core.session.IoSession ioSession, WriteRequest writeRequest) {
}
@Override
public void updateTrafficControl(org.apache.mina.core.session.IoSession ioSession) {
}
@Override
public void remove(org.apache.mina.core.session.IoSession ioSession) {
}
};
server.setRandomFactory(new SingletonRandomFactory(SecurityUtils.getRandomFactory()));
this.session = new ServerSessionImpl(server, new MinaSession(new MinaConnector(server, ioHandler, ioProcessor), new DummySession(), SshdSocketAddress.LOCALHOST_ADDRESS));
}
Aggregations