Skip to content

Commit

Permalink
Add SslProtocol Info to SecurableDuplexPipe (#222)
Browse files Browse the repository at this point in the history
* Add SslProtocol Info to SecurableDuplexPipe

Add the option of querying which SslProtocol was used to establish the connection is added for an encrypted connection

* set SslProtocols default to SslProtocols.None
  • Loading branch information
tinohager authored Aug 20, 2024
1 parent 1975ee2 commit 9d253c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Src/SmtpServer/IO/SecurableDuplexPipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task UpgradeAsync(X509Certificate certificate, SslProtocols protoco
await stream.AuthenticateAsServerAsync(certificate, false, protocols, true).ConfigureAwait(false);

_stream = stream;

Input = PipeReader.Create(_stream);
Output = PipeWriter.Create(_stream);
}
Expand Down Expand Up @@ -88,5 +88,10 @@ public void Dispose()
/// Returns a value indicating whether or not the current pipeline is secure.
/// </summary>
public bool IsSecure => _stream is SslStream;

/// <summary>
/// Returns the used SslProtocol of a secure pipeline
/// </summary>
public SslProtocols SslProtocol => (_stream as SslStream)?.SslProtocol ?? SslProtocols.None;
}
}
}

0 comments on commit 9d253c4

Please sign in to comment.