Skip to content

Commit fc906e2

Browse files
author
Lee Fine
committed
1 parent 65c597c commit fc906e2

6 files changed

Lines changed: 13 additions & 283 deletions

File tree

Certificate Store Type CURL Scripts/DER.curl

Lines changed: 0 additions & 56 deletions
This file was deleted.

Certificate Store Type CURL Scripts/JKS.curl

Lines changed: 0 additions & 48 deletions
This file was deleted.

Certificate Store Type CURL Scripts/KDB.curl

Lines changed: 0 additions & 48 deletions
This file was deleted.

Certificate Store Type CURL Scripts/PEM.curl

Lines changed: 0 additions & 80 deletions
This file was deleted.

Certificate Store Type CURL Scripts/PKCS12.curl

Lines changed: 0 additions & 48 deletions
This file was deleted.

RemoteFile/ImplementedStoreTypes/KDB/KDBCertificateStoreSerializer.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)