Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify certificate file in ssh connection #498

Open
gvethon opened this issue Feb 6, 2024 · 1 comment
Open

Specify certificate file in ssh connection #498

gvethon opened this issue Feb 6, 2024 · 1 comment

Comments

@gvethon
Copy link

gvethon commented Feb 6, 2024

I am trying to create java ssh session with private key and certificate. I have private key like:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9...
-----END OPENSSH PRIVATE KEY-----

and certificate file:

ssh-rsa-cert-v01@openssh.com AAAAHHNzaC1yc2EtY2VydC1

I am calling: ssh -i key-file -o PasswordAuthentication=no -o CertificateFile=cert-file username@host
In CLI it works fine but I can not do it in Java. This is example code:

JSch jSch = new JSch();
jSch.addIdentity("keyFilePath");
jSch.setConfig("CertificateFile", "certFilePath");
session = jSch.getSession("username", "host");
session.connect();

And this is result:
com.jcraft.jsch.JSchException: Auth fail for methods 'publickey,gssapi-keyex,gssapi-with-mic,password'

Any help?

@norrisjeremy
Copy link
Contributor

Hi @gvethon,

JSch does not currently support OpenSSH type certificates (see #31).

Thanks,
Jeremy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants