garydgregory commented on a change in pull request #60: VFS-609: VFS SFTP 
doesn't support a private key as byte array
URL: https://github.com/apache/commons-vfs/pull/60#discussion_r279152827
 
 

 ##########
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpClientFactory.java
 ##########
 @@ -195,11 +195,17 @@ private static void setConfigRepository(final JSch jsch, 
final File sshDir, fina
         }
     }
 
-    private static void addIndentity(final JSch jsch, final IdentityInfo info) 
throws FileSystemException {
+    private static void addIdentity(final JSch jsch, final IdentityInfo info) 
throws FileSystemException {
         try {
-            final String privateKeyFile = info.getPrivateKey() != null ? 
info.getPrivateKey().getAbsolutePath() : null;
-            final String publicKeyFile = info.getPublicKey() != null ? 
info.getPublicKey().getAbsolutePath() : null;
-            jsch.addIdentity(privateKeyFile, publicKeyFile, 
info.getPassPhrase());
+            if (info.getPrivateKey() != null) {
 
 Review comment:
   What should happen if the `info` contains BOTH a private key file and 
private key bytes? Right now the file quietly overrides the bytes. This is good 
for compatibility. If neither are set you get an exception, which is new 
behavior. 
   Should we throw an exception if both are set?
   Is it possible for the provider to be used _without_ a PK? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to