Class GitSshServer
- java.lang.Object
- 
- org.apache.maven.scm.provider.git.GitSshServer
 
- 
 public class GitSshServer extends Object Local Git SSH server for testing purposes. It acts on top of an existing repository root directory. It uses Apache MINA SSHD for the SSH server implementation.The server generates a key pair during initialization and accepts connections using the private key which can be extracted via writePrivateKeyAsPkcs8(Path, String). Alternatively one may use a custom key pair and add the public key usingaddPublicKey(PublicKey).
- 
- 
Constructor SummaryConstructors Constructor Description GitSshServer()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPublicKey(PublicKey publicKey)intgetPort()voidstart(Path repositoryRoot)voidstop()voidwritePrivateKeyAsPkcs8(Path file, String passphrase)Writes a private key which is accepted by this server to the specified file in PKCS8 format.
 
- 
- 
- 
Constructor Detail- 
GitSshServerpublic GitSshServer() throws GeneralSecurityException - Throws:
- GeneralSecurityException
 
 
- 
 - 
Method Detail- 
writePrivateKeyAsPkcs8public void writePrivateKeyAsPkcs8(Path file, String passphrase) throws IOException, GeneralSecurityException Writes a private key which is accepted by this server to the specified file in PKCS8 format. If a passphrase is provided, the key will be encrypted using OpenSSH's format. If no passphrase is provided, the key will be written as an unencrypted PKCS8 private key. For the same server instance the private key is always the same, so it can be reused.- Parameters:
- file- the file to write the private key to
- passphrase- the passphrase for encryption, or null for unencrypted
- Throws:
- GeneralSecurityException- if a security error occurs
- IOException- if an I/O error occurs
 
 - 
addPublicKeypublic void addPublicKey(PublicKey publicKey) 
 - 
getPortpublic int getPort() 
 - 
startpublic void start(Path repositoryRoot) throws IOException - Throws:
- IOException
 
 - 
stoppublic void stop() throws IOException - Throws:
- IOException
 
 
- 
 
-