Skip to content

Instantly share code, notes, and snippets.

@dylanvee
Created October 3, 2012 06:11
Show Gist options
  • Save dylanvee/3825342 to your computer and use it in GitHub Desktop.
Save dylanvee/3825342 to your computer and use it in GitHub Desktop.
JRuby + Apache Mina SSHD public key
require 'net/ssh'
class CustomPublickeyAuthenticator
include PublickeyAuthenticator
def authenticate(username, key, session)
key = String.from_java_bytes(key.getEncoded)
key = [OpenSSL::PKey::RSA.new(key).to_blob].pack('m0')
# The key is now a string
# Your public key authentication magic here
# Return true for auth success and false for failure
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment