Skip to content

Commit f3c6757

Browse files
committed
refactor write ssl key
1 parent 3decef7 commit f3c6757

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/S7CommPlusDriver/Net/S7Client.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ namespace S7CommPlusDriver
2222
public class S7Client : OpenSSLConnector.IConnectorCallback
2323
{
2424
//TODO: better API, maybe a Callback
25-
public static bool WriteSslKeyToFile;
26-
27-
#region [Constants and TypeDefs]
28-
29-
public int _LastError = 0;
25+
public static bool WriteSslKeyToFile;
26+
public static string WriteSslKeyPath;
27+
28+
#region [Constants and TypeDefs]
29+
30+
public int _LastError = 0;
3031

3132
#endregion
3233

@@ -110,6 +111,8 @@ public void OnDataAvailable()
110111
public void SSL_CTX_keylog_cb(IntPtr ssl, string line)
111112
{
112113
string filename = "key_" + m_DateTimeStarted.ToString("yyyyMMdd_HHmmss") + ".log";
114+
if (WriteSslKeyPath != null)
115+
filename = Path.Combine(WriteSslKeyPath, filename);
113116
StreamWriter file = new StreamWriter(filename, append: true);
114117
file.WriteLine(line);
115118
file.Close();

0 commit comments

Comments
 (0)