@@ -78,7 +78,10 @@ public List<SerializedStoreInfo> SerializeRemoteCertificateStore(Pkcs12Store cer
7878 logger . MethodEntry ( LogLevel . Debug ) ;
7979
8080 List < SerializedStoreInfo > storeInfo = new List < SerializedStoreInfo > ( ) ;
81+
8182 string bashCommand = storePath . Substring ( 0 , 1 ) == "/" ? "bash " : string . Empty ;
83+ if ( storePath . Substring ( 0 , 1 ) == "|" )
84+ storePath = "/" + storePath . Substring ( 1 ) ;
8285
8386 string tempStoreFile = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , string . Empty ) + ".kdb" ;
8487 string tempCertFile = Guid . NewGuid ( ) . ToString ( ) . Replace ( "-" , string . Empty ) + ".p12" ;
@@ -96,17 +99,24 @@ public List<SerializedStoreInfo> SerializeRemoteCertificateStore(Pkcs12Store cer
9699 byte [ ] storeContents = remoteHandler . DownloadCertificateFile ( $ "{ storePath } { tempStoreFile } ") ;
97100
98101 storeInfo . Add ( new SerializedStoreInfo ( ) { Contents = storeContents , FilePath = storePath + storeFileName } ) ;
99- return storeInfo ;
100102 }
101- catch ( Exception )
103+ catch ( Exception ex )
102104 {
103- throw ;
105+ if ( ex . Message . Contains ( "cannot execute binary file" , StringComparison . InvariantCultureIgnoreCase ) && storePath . Substring ( 0 , 1 ) == "/" )
106+ {
107+ storePath = "|" + storePath . Substring ( 1 ) ;
108+ storeInfo = SerializeRemoteCertificateStore ( certificateStore , storePath , storeFileName , storePassword , remoteHandler ) ;
109+ }
110+ else
111+ throw ;
104112 }
105113 finally
106114 {
107115 try { remoteHandler . RemoveCertificateFile ( storePath , tempStoreFile ) ; } catch ( Exception ) { } ;
108116 try { remoteHandler . RemoveCertificateFile ( storePath , tempCertFile ) ; } catch ( Exception ) { } ;
109117 }
118+
119+ return storeInfo ;
110120 }
111121
112122 public string GetPrivateKeyPath ( )
0 commit comments