Apologies in advance, I’m an svn noob, more-or-less java noob, actually a 
relative Linux noob :).

So, for reasons I can’t go into here, I need to be able to present an in-memory 
version of my private key to authorize SVNRepository with.  After much reading, 
it seemed to me that I need to implement ISVNAuthenticationProvider, using it 
to instantiate an SVNSSHAuthentication object, which I pass a char[] array to 
in ctor, with contents of my private key.

The actual code looks like:

ISVNAuthenticationManager mgr = SVNWCUtil.createDefaultAuthenticationManager();

  mgr.setAuthenticationProvider(new AuthProvider());

  repository.setAuthenticationManager(mgr);


And then the ISVNAuthenticationProvider impl looks like:

 class AuthProvider implements ISVNAuthenticationProvider
{
    public int acceptServerAuthentication(....)

   public SVNAuthentication requestClientAuthentication(String kind, SVNUrl 
url, String realm, SVNErrorMessage errMsg, SVNAuthentication prevAuth, boolean 
authMaybeStored)
{
      // so, I get the contents of my private key – for corporate privacy 
reasons, can’t show how I’m getting this – if you can just assume I have it.
     char[] private_key;
     SVNSSHAuthentication sshAuth = new SVNSSHAuthentication(user, private_key, 
null, 22, false, url, false);
    return sshAuth;

}
}

So, over and over again this thing gets called, with the errMsg value of “svn: 
File ‘NULL’ is not valid OpenSSH DSA or RSA private key file”

So, is this message referring to the java.io.File object private key file 
that’s passed as an argument to other ctors for this class?   But...I’m using 
the ctor that takes a char[] instead of a File, because that’s exactly my 
requirement – I can’t have the file on disk (again, for reasons I can’t go 
into).

Can anyone guide me as to the correct way to accomplish what I’m trying to 
accomplish?   In a nutshell, the requirement is that I am not going to have an 
on-disk representation of the private key; I’ll have an in-memory version only. 
  Is there a way to accomplish auth with svnkit this way, given this constraint?

Thanks for any insight,
Don Clore

Reply via email to