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 CipherSuite(TCipherSuite cipherSuite, TKeyExchangeAlgorithm keyExchangeAlgorithm, TSignatureAlgorithm signatureAlgorithm, Version minVersion, TPseudorandomFunction prf) { Suite = cipherSuite; KeyExchangeAlgorithm = keyExchangeAlgorithm; SignatureAlgorithm = signatureAlgorithm; MinVersion = minVersion; PRF = prf; }
public CipherSuite(TCipherSuite cipherSuite, TKeyExchangeAlgorithm keyExchangeAlgorithm, TSignatureAlgorithm signatureAlgorithm, Version minVersion,TPseudorandomFunction prf) { Suite = cipherSuite; KeyExchangeAlgorithm = keyExchangeAlgorithm; SignatureAlgorithm = signatureAlgorithm; MinVersion = minVersion; PRF = prf; }
public CipherSuite(TCipherSuite cipherSuite, TKeyExchangeAlgorithm keyExchangeAlgorithm, TSignatureAlgorithm signatureAlgorithm, Version minVersion, TPseudorandomFunction prf) { this.Suite = cipherSuite; this.KeyExchangeAlgorithm = keyExchangeAlgorithm; this.SignatureAlgorithm = signatureAlgorithm; this.MinVersion = minVersion ?? throw new ArgumentNullException(nameof(minVersion)); this.PRF = prf; }
public static TPseudorandomFunction GetPseudorandomFunction(Version version, TCipherSuite cipherSuite) { TPseudorandomFunction result = TPseudorandomFunction.Legacy; if (version >= DTLSRecord.Version1_2) { CipherSuite suite; if (_CipherSuites.TryGetValue(cipherSuite, out suite)) { result = suite.PRF; } } return(result); }