Class DtlsSrtpClient
Class for a DTLS-SRTP handshake client.
Inherited Members
Namespace: SipLib.Dtls
Assembly: SipLib.dll
Syntax
public class DtlsSrtpClient : DefaultTlsClient, TlsClient, TlsPeer, IDtlsSrtpPeer
Constructors
| Edit this page View SourceDtlsSrtpClient()
Constructor. Creates a self-signed certificate.
Declaration
public DtlsSrtpClient()
DtlsSrtpClient(Certificate, AsymmetricKeyParameter)
Constructor
Declaration
public DtlsSrtpClient(Certificate certificateChain, AsymmetricKeyParameter privateKey)
Parameters
Type | Name | Description |
---|---|---|
Certificate | certificateChain | |
AsymmetricKeyParameter | privateKey |
DtlsSrtpClient(Certificate, AsymmetricKeyParameter, UseSrtpData)
Constructor
Declaration
public DtlsSrtpClient(Certificate certificateChain, AsymmetricKeyParameter privateKey, UseSrtpData clientSrtpData)
Parameters
Type | Name | Description |
---|---|---|
Certificate | certificateChain | Contains at least one X.509 certificate. If null, then a self-signed certificate will be automatically created. |
AsymmetricKeyParameter | privateKey | Private key for the certificate |
UseSrtpData | clientSrtpData | BouncyCastle UseSrtpData object to use. May be null. If null the a UseSrtpData object will be created. The UseSrtpData class contains the SRTP protection profiles and the Master Key Index that will be negotiated during the DTLS handshake process. |
DtlsSrtpClient(UseSrtpData)
Constructor
Declaration
public DtlsSrtpClient(UseSrtpData clientSrtpData)
Parameters
Type | Name | Description |
---|---|---|
UseSrtpData | clientSrtpData |
DtlsSrtpClient(X509Certificate2)
Constructor. Creates a self-signed certificate from a .NET X509Certificate2
Declaration
public DtlsSrtpClient(X509Certificate2 certificate)
Parameters
Type | Name | Description |
---|---|---|
X509Certificate2 | certificate | Input certificate |
DtlsSrtpClient(string, string)
Constructor.
Declaration
public DtlsSrtpClient(string certificatePath, string keyPath)
Parameters
Type | Name | Description |
---|---|---|
string | certificatePath | File path to the certificate file |
string | keyPath | File path to the private key file |
DtlsSrtpClient(string[], string)
Constructor
Declaration
public DtlsSrtpClient(string[] certificatesPath, string keyPath)
Parameters
Type | Name | Description |
---|---|---|
string[] | certificatesPath | |
string | keyPath |
Fields
| Edit this page View SourcemSession
Contains the Org.BouncyCastle.Crypto.Tls.TlsSession
Declaration
protected TlsSession? mSession
Field Value
Type | Description |
---|---|
TlsSession |
Properties
| Edit this page View SourceClientVersion
Gets the protcol version for this client
Declaration
public override ProtocolVersion ClientVersion { get; }
Property Value
Type | Description |
---|---|
ProtocolVersion |
Overrides
Fingerprint
Gets the fingerprint of the X.509 certificate used by this client
Declaration
public RTCDtlsFingerprint? Fingerprint { get; }
Property Value
Type | Description |
---|---|
RTCDtlsFingerprint |
ForceUseExtendedMasterSecret
Gets or sets a flag to indicate whether or not to force the use of the extended MasterSecret. Defaults to true.
Declaration
public bool ForceUseExtendedMasterSecret { get; set; }
Property Value
Type | Description |
---|---|
bool |
MinimumVersion
Gets the minimum version support by this client
Declaration
public override ProtocolVersion MinimumVersion { get; }
Property Value
Type | Description |
---|---|
ProtocolVersion |
Overrides
ServerCertificate
Gets the Certificate received from the server.
Declaration
public Certificate ServerCertificate { get; }
Property Value
Type | Description |
---|---|
Certificate |
Methods
| Edit this page View SourceGetAuthentication()
Gets the authentication information
Declaration
public override TlsAuthentication GetAuthentication()
Returns
Type | Description |
---|---|
TlsAuthentication |
Overrides
GetClientExtensions()
Gets the DTLS extensions for this DTLS-SRTP client.
Declaration
public override IDictionary GetClientExtensions()
Returns
Type | Description |
---|---|
IDictionary | Returns a dictionary containing the client DTLS extensions |
Overrides
GetKeyingMaterial(int)
Gets the keying material (master keys and master salts)
Declaration
protected byte[] GetKeyingMaterial(int length)
Parameters
Type | Name | Description |
---|---|---|
int | length |
Returns
Type | Description |
---|---|
byte[] |
GetKeyingMaterial(string, byte[], int)
Gets the keying material (master keys and master salts)
Declaration
protected virtual byte[] GetKeyingMaterial(string asciiLabel, byte[] context_value, int length)
Parameters
Type | Name | Description |
---|---|---|
string | asciiLabel | |
byte[] | context_value | |
int | length |
Returns
Type | Description |
---|---|
byte[] |
GetRemoteCertificate()
Gets the Certificate of the server
Declaration
public Certificate GetRemoteCertificate()
Returns
Type | Description |
---|---|
Certificate |
GetSessionToResume()
Gets the DTLS-SRTP session to resume
Declaration
public override TlsSession GetSessionToResume()
Returns
Type | Description |
---|---|
TlsSession |
Overrides
GetSrtcpPolicy()
Gets the SRTCP encryption and authenticaion policy information for the DTLS-SRTP session
Declaration
public virtual SrtpPolicy GetSrtcpPolicy()
Returns
Type | Description |
---|---|
SrtpPolicy |
GetSrtpMasterClientKey()
Gets the client's master key
Declaration
public virtual byte[] GetSrtpMasterClientKey()
Returns
Type | Description |
---|---|
byte[] |
GetSrtpMasterClientSalt()
Gets the client's master salt
Declaration
public virtual byte[] GetSrtpMasterClientSalt()
Returns
Type | Description |
---|---|
byte[] |
GetSrtpMasterServerKey()
Gets the server's master key for SRTP
Declaration
public virtual byte[] GetSrtpMasterServerKey()
Returns
Type | Description |
---|---|
byte[] |
GetSrtpMasterServerSalt()
Gets the server's master salt
Declaration
public virtual byte[] GetSrtpMasterServerSalt()
Returns
Type | Description |
---|---|
byte[] |
GetSrtpPolicy()
Gets the SRTP encryption and authentication policy information for the DTLS-SRTP session
Declaration
public virtual SrtpPolicy GetSrtpPolicy()
Returns
Type | Description |
---|---|
SrtpPolicy |
IsClient()
Always returns true because this object is the DTLS client
Declaration
public bool IsClient()
Returns
Type | Description |
---|---|
bool |
NotifyAlertRaised(byte, byte, string, Exception)
Called by the transport if a DTLS-SRTP protocol alert has been raised.
Declaration
public override void NotifyAlertRaised(byte alertLevel, byte alertDescription, string message, Exception cause)
Parameters
Type | Name | Description |
---|---|---|
byte | alertLevel | |
byte | alertDescription | |
string | message | |
Exception | cause |
Overrides
| Edit this page View SourceNotifyAlertReceived(byte, byte)
Called if a protocol Alert was received
Declaration
public override void NotifyAlertReceived(byte alertLevel, byte alertDescription)
Parameters
Type | Name | Description |
---|---|---|
byte | alertLevel | |
byte | alertDescription |
Overrides
| Edit this page View SourceNotifyHandshakeComplete()
Called when the DTLS handshake is completed
Declaration
public override void NotifyHandshakeComplete()
Overrides
NotifyServerVersion(ProtocolVersion)
Called during the protocol handshake to set the protocol version of the server
Declaration
public override void NotifyServerVersion(ProtocolVersion serverVersion)
Parameters
Type | Name | Description |
---|---|---|
ProtocolVersion | serverVersion |
Overrides
PrepareSrtpSharedSecret()
Prepares the SRTP-DTLS shared secret for the DTLS-SRTP handshake
Declaration
protected virtual void PrepareSrtpSharedSecret()
ProcessServerExtensions(IDictionary)
Processes the DTLS handshake extensions received from the DTLS server
Declaration
public override void ProcessServerExtensions(IDictionary clientExtensions)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | clientExtensions |
Overrides
| Edit this page View SourceRequiresExtendedMasterSecret()
Returns true if an extended master secret is required.
Declaration
public override bool RequiresExtendedMasterSecret()
Returns
Type | Description |
---|---|
bool |
Overrides
Events
| Edit this page View SourceOnAlert
Event that is fired when an Alert is received from the server during the DTLS handshake
Declaration
public event Action<AlertLevelsEnum, AlertTypesEnum, string>? OnAlert
Event Type
Type | Description |
---|---|
Action<AlertLevelsEnum, AlertTypesEnum, string> |