Created
October 3, 2012 06:11
-
-
Save dylanvee/3825342 to your computer and use it in GitHub Desktop.
JRuby + Apache Mina SSHD public key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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