class SshUtils implements InitializingBean {

    protected Session authenticateSshSessionWithPublicKey(Connection sshConnection) throws IOException {
        sshConnection.connect(null, CONNECT_TIMEOUT, CONNECT_TIMEOUT);
        if (!sshConnection.authenticateWithPublicKey("root", certificate, null)) {
            throw new CloudRuntimeException(String.format("Unable to authenticate to (%s)", sshConnection.getHostname()));
        }
        return sshConnection.openSession();
    }

}