Last bash at getting key based auth working

couldn't get key based auth working without ssh agent in libssh2 the
library documentation was awful and i was getting to the point where i'd
have to rewrite it.