GetKeyExchangeAlgorithm() public static method

public static GetKeyExchangeAlgorithm ( int ciphersuite ) : int
ciphersuite int
return int
Ejemplo n.º 1
0
        public override TlsCredentials GetCredentials()
        {
            int keyExchangeAlgorithm = TlsUtilities.GetKeyExchangeAlgorithm(this.mSelectedCipherSuite);
            int num = keyExchangeAlgorithm;

            switch (num)
            {
            case 13:
            case 14:
                break;

            case 15:
                return(this.GetRsaEncryptionCredentials());

            default:
                if (num != 24)
                {
                    throw new TlsFatalAlert(80);
                }
                break;
            }
            return(null);
        }
Ejemplo n.º 2
0
        public override TlsKeyExchange GetKeyExchange()
        {
            int keyExchangeAlgorithm = TlsUtilities.GetKeyExchangeAlgorithm(mSelectedCipherSuite);

            switch (keyExchangeAlgorithm)
            {
            case KeyExchangeAlgorithm.DH_anon:
            case KeyExchangeAlgorithm.DH_DSS:
            case KeyExchangeAlgorithm.DH_RSA:
                return(CreateDHKeyExchange(keyExchangeAlgorithm));

            case KeyExchangeAlgorithm.DHE_DSS:
            case KeyExchangeAlgorithm.DHE_RSA:
                return(CreateDheKeyExchange(keyExchangeAlgorithm));

            case KeyExchangeAlgorithm.ECDH_anon:
            case KeyExchangeAlgorithm.ECDH_ECDSA:
            case KeyExchangeAlgorithm.ECDH_RSA:
                return(CreateECDHKeyExchange(keyExchangeAlgorithm));

            case KeyExchangeAlgorithm.ECDHE_ECDSA:
            case KeyExchangeAlgorithm.ECDHE_RSA:
                return(CreateECDheKeyExchange(keyExchangeAlgorithm));

            case KeyExchangeAlgorithm.RSA:
                return(CreateRsaKeyExchange());

            default:
                /*
                 * Note: internal error here; the TlsProtocol implementation verifies that the
                 * server-selected cipher suite was in the list of client-offered cipher suites, so if
                 * we now can't produce an implementation, we shouldn't have offered it!
                 */
                throw new TlsFatalAlert(AlertDescription.internal_error);
            }
        }