identities = new IdentityInfo[] { new IdentityInfo( new File( value ) ) }; } else { identities = temp; identities[identities.length - 1] = new IdentityInfo( new File( value ) );
/** * Sets the identity files (your private key files). * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. * * @param opts The FileSystem options. * @param identityFiles An array of identity Files. * @throws FileSystemException if an error occurs. * @deprecated As of 2.1 use {@link #setIdentityInfo(FileSystemOptions, IdentityInfo...)} */ @Deprecated public void setIdentities(final FileSystemOptions opts, final File... identityFiles) throws FileSystemException { IdentityInfo[] info = null; if (identityFiles != null) { info = new IdentityInfo[identityFiles.length]; for (int i = 0; i < identityFiles.length; i++) { info[i] = new IdentityInfo(identityFiles[i]); } } this.setParam(opts, IDENTITIES, info); }
private static void addIdentities(final JSch jsch, final File sshDir, final IdentityInfo[] identities) throws FileSystemException { if (identities != null) { for (final IdentityInfo info : identities) { addIndentity(jsch, info); } } else { // Load the private key (rsa-key only) final File privateKeyFile = new File(sshDir, "id_rsa"); if (privateKeyFile.isFile() && privateKeyFile.canRead()) { addIndentity(jsch, new IdentityInfo(privateKeyFile)); } } }
/** * Sets the identity files (your private key files). * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. * * @param opts The FileSystem options. * @param identityFiles An array of identity Files. * @throws FileSystemException if an error occurs. * @deprecated As of 2.1 use {@link #setIdentityInfo(FileSystemOptions, IdentityInfo...)} */ @Deprecated public void setIdentities(final FileSystemOptions opts, final File... identityFiles) throws FileSystemException { IdentityInfo[] info = null; if (identityFiles != null) { info = new IdentityInfo[identityFiles.length]; for (int i = 0; i < identityFiles.length; i++) { info[i] = new IdentityInfo(identityFiles[i]); } } this.setParam(opts, IDENTITIES, info); }
private static void addIdentities(final JSch jsch, final File sshDir, final IdentityInfo[] identities) throws FileSystemException { if (identities != null) { for (final IdentityInfo info : identities) { addIndentity(jsch, info); } } else { // Load the private key (rsa-key only) final File privateKeyFile = new File(sshDir, "id_rsa"); if (privateKeyFile.isFile() && privateKeyFile.canRead()) { addIndentity(jsch, new IdentityInfo(privateKeyFile)); } } }
/** * Sets the identity files (your private key files). * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. * * @param opts The FileSystem options. * @param identityFiles An array of identity Files. * @throws FileSystemException if an error occurs. * @deprecated As of 2.1 use {@link #setIdentityInfo(FileSystemOptions, IdentityInfo...)} */ @Deprecated public void setIdentities(final FileSystemOptions opts, final File... identityFiles) throws FileSystemException { IdentityInfo[] info = null; if (identityFiles != null) { info = new IdentityInfo[identityFiles.length]; for (int i = 0; i < identityFiles.length; i++) { info[i] = new IdentityInfo(identityFiles[i]); } } this.setParam(opts, IDENTITIES, info); }
private static void addIdentities(final JSch jsch, final File sshDir, final IdentityInfo[] identities) throws FileSystemException { if (identities != null) { for (final IdentityInfo info : identities) { addIndentity(jsch, info); } } else { // Load the private key (rsa-key only) final File privateKeyFile = new File(sshDir, "id_rsa"); if (privateKeyFile.isFile() && privateKeyFile.canRead()) { addIndentity(jsch, new IdentityInfo(privateKeyFile)); } } }
/** * Sets the identity files (your private key files). * <p> * We use {@link java.io.File} because JSch cannot deal with VFS FileObjects. * * @param opts The FileSystem options. * @param identityFiles An array of identity Files. * @throws FileSystemException if an error occurs. * @deprecated As of 2.1 use {@link #setIdentityInfo(FileSystemOptions, IdentityInfo...)} */ @Deprecated public void setIdentities(final FileSystemOptions opts, final File... identityFiles) throws FileSystemException { IdentityInfo[] info = null; if (identityFiles != null) { info = new IdentityInfo[identityFiles.length]; for (int i = 0; i < identityFiles.length; i++) { info[i] = new IdentityInfo(identityFiles[i]); } } this.setParam(opts, IDENTITIES, info); }
public static void addIdentities(final JSch jsch, final File sshDir, final IdentityInfo[] identities) throws FileSystemException { if (identities != null) { for (final IdentityInfo info : identities) { addIndentity(jsch, info); } } else { // Load the private key (rsa-key only) final File privateKeyFile = new File(sshDir, "id_rsa"); if (privateKeyFile.isFile() && privateKeyFile.canRead()) { addIndentity(jsch, new IdentityInfo(privateKeyFile)); } } }
public static FileSystemOptions buildSftpOpts(File privateKey, byte[] passPhrase) throws FileSystemException { FileSystemOptions opts = new FileSystemOptions(); SftpFileSystemConfigBuilder builder = SftpFileSystemConfigBuilder.getInstance(); builder.setUserDirIsRoot(opts, false); builder.setIdentityInfo(opts, new IdentityInfo(privateKey, passPhrase)); return opts; }