Documentation
Introduction
Open Source Release Policy
Export Compliance
Using BouncyCastle
Installing the API
Enabling Logging
Per-Connection Logging
Third Party Dependencies
Generating SSH Keys
Using BouncyCastle
Using SSH Public Keys in Java
Supporting ED25519/Curve25519
Supporting Compression
Integrating Licensing into Maven Builds
Open Source Release Policy
Export Compliance
Using BouncyCastle
Installing the API
Enabling Logging
Per-Connection Logging
Third Party Dependencies
Generating SSH Keys
Using BouncyCastle
Using SSH Public Keys in Java
Supporting ED25519/Curve25519
Supporting Compression
Integrating Licensing into Maven Builds
Client API
Quick Start
Creating an SSH Client
Public Key Authentication
Keyboard Interactive Authentication
Public Key Authentication with sshagent
Executing Single Commands
Executing Commands within a Shell
Transferring Files
Connecting through Proxies
Display the Authentication Banner
Using the SFTP Client
Port Forwarding
Creating an SSH Client
Public Key Authentication
Keyboard Interactive Authentication
Public Key Authentication with sshagent
Executing Single Commands
Executing Commands within a Shell
Transferring Files
Connecting through Proxies
Display the Authentication Banner
Using the SFTP Client
Port Forwarding
Working Examples
Server API
Creating an SSH Server
Configuring Listening Interfaces
Configuring Host Keys
Password Authentication
Public Key Authentication
Challenge-Response Authentication
Configuring Port Forwarding
Configuring SFTP
Supporting SCP
Implementing your own File System
Creating an Interactive Terminal
Proxy Protocol Support
Configuring Listening Interfaces
Configuring Host Keys
Password Authentication
Public Key Authentication
Challenge-Response Authentication
Configuring Port Forwarding
Configuring SFTP
Supporting SCP
Implementing your own File System
Creating an Interactive Terminal
Proxy Protocol Support
Configuring Host Keys
Every SSH server requires a set of keys to identify itself with connecting clients.
If you want these to be generated automatically, you do not need to do anything more when using the SshServer-based implementation. The server will generate a key for each type of public key algorithm supported by the API and save the file in the current working directory, which will then be loaded each time the server starts.
If you want more control over the loading of host keys, you should add them to your SshServer before starting it.
SshServer server = new SshServer(2222);
server.addHostKey(SshKeyUtils.getPrivateKey(new File("rsa_hostkey"))); server.addHostKey(SshKeyUtils.getPrivateKey(new File("ed25519_hostkey")));
Code language: JavaScript (javascript)
Support for rsa-sha2-256 and rsa-sha2-512 signing algorithms is automatic. If you add an RSA key, the SHA2 versions will automatically be configured for that key.