Example #1
0
        public IKeyshareInstance GetDefaultKeyShare(KeyExchangeType exchangeType)
        {
            switch (exchangeType)
            {
            case KeyExchangeType.Ecdhe:
                return(KeyShareProvider.GetKeyShareInstance(_priorityOrderedEchdeExchanges[0]));

            default:
                Alerts.AlertException.ThrowAlert(Alerts.AlertLevel.Fatal, Alerts.AlertDescription.decode_error, $"No matching key exchange for {exchangeType}");
                return(null);
            }
        }
        /// <summary>
        /// Heritage KeyExchange selection (pre tls 1.3)
        /// </summary>
        /// <param name="keyExchange"></param>
        /// <param name="supportedGroups"></param>
        /// <returns></returns>
        public IKeyExchange GetKeyExchange(KeyExchangeType keyExchange, BigEndianAdvancingSpan supportedGroups)
        {
            switch (keyExchange)
            {
            case KeyExchangeType.Rsa:
                return(new RsaKeyExchange());

            case KeyExchangeType.Ecdhe:
                return(EcdheKeyExchange(supportedGroups));

            default:
                Alerts.AlertException.ThrowAlert(Alerts.AlertLevel.Fatal, Alerts.AlertDescription.handshake_failure, "Unable to match key exchange");
                return(null);
            }
        }
 public abstract KeyExchange GetKeyExchange(KeyExchangeType keyExchange, ReadOnlySequence <byte> supportedGroups);