public DTLSSecurityParameters(Version version, HandshakeInfo handshakeInfo) { _HandshakeInfo = handshakeInfo; if (handshakeInfo != null) { _ClientRandom = handshakeInfo.ClientRandom.Serialise(); _ServerRandom = handshakeInfo.ServerRandom.Serialise(); } TPseudorandomFunction prf = CipherSuites.GetPseudorandomFunction(version, handshakeInfo.CipherSuite); switch (prf) { case TPseudorandomFunction.NotSet: break; case TPseudorandomFunction.Legacy: _PrfAlgorithm = Org.BouncyCastle.Crypto.Tls.PrfAlgorithm.tls_prf_legacy; break; case TPseudorandomFunction.SHA256: _PrfAlgorithm = Org.BouncyCastle.Crypto.Tls.PrfAlgorithm.tls_prf_sha256; break; case TPseudorandomFunction.SHA384: _PrfAlgorithm = Org.BouncyCastle.Crypto.Tls.PrfAlgorithm.tls_prf_sha384; break; default: break; } }
public DTLSSecurityParameters(Version version, HandshakeInfo handshakeInfo) { if (version == null) { throw new ArgumentNullException(nameof(version)); } this._HandshakeInfo = handshakeInfo; if (handshakeInfo != null) { this._ClientRandom = handshakeInfo.ClientRandom.Serialise(); this._ServerRandom = handshakeInfo.ServerRandom.Serialise(); } switch (CipherSuites.GetPseudorandomFunction(version, handshakeInfo.CipherSuite)) { case TPseudorandomFunction.NotSet: { break; } case TPseudorandomFunction.Legacy: { this._PrfAlgorithm = BcTls.PrfAlgorithm.tls_prf_legacy; break; } case TPseudorandomFunction.SHA256: { this._PrfAlgorithm = BcTls.PrfAlgorithm.tls_prf_sha256; break; } case TPseudorandomFunction.SHA384: { this._PrfAlgorithm = BcTls.PrfAlgorithm.tls_prf_sha384; break; } default: { break; } } }