0

apache mina sshd authenticate client signatures

I found this link, I have implemented the PublicKeyAuthenticator's authenticate method and using KeyUtils.compareKeys method to compare the public key of the user stored and the incoming key. But its not matching. What is the format of the key that needs to be stored in the local to compare against the incoming public key? I have been breaking my head on this for the last few weeks and couldnt solve this. Please help.

Siva
  • 21
  • 1
  • 5

2 Answers2

1

I think the key should start with -----BEGIN RSA PRIVATE KEY----- to be recognizable by Apache Mina.

If you are using putty gen key, which starts with PuTTY-User-Key-File-2: ssh-rsa, there should be some tweaks to be made to work with these files, something like:

PuttyKeyUtils.DEFAULT_INSTANCE.loadKeyPairs(Paths.get(privateKey), FilePasswordProvider.of(this.pwd)))
SilverNak
  • 3,283
  • 4
  • 28
  • 44
Rajeev Joshi
  • 21
  • 1
  • 3
0

put a breakpoint on compareKeys() in KeyUtils, you will be able to see the keys being compared and try to find their type. I had a similar problem and for me turns it was not able to compare OpenSshCertificate type of public key.

shellHell
  • 11
  • 3