Beispiel #1
0
        private string fixCipherAlgorithms(string algorithms)
        {
            if (algorithms == null)
            {
                return(null);
            }
            string[] inputAlgorithms   = algorithms.Split(';');
            string[] defaultAlgorithms = DEFAULT_CIPHER_ALGORITHM_ORDER.Split(';');
            string[] validAlgorithms   = new string[defaultAlgorithms.Length];
            int      index             = 0;

            foreach (string algo in inputAlgorithms)
            {
                for (int i = 0; i < defaultAlgorithms.Length; i++)
                {
                    if (defaultAlgorithms[i] != null && defaultAlgorithms[i] == algo)
                    {
                        validAlgorithms[index++] = algo;
                        defaultAlgorithms[i]     = null;
                        break;
                    }
                }
            }
            foreach (string algo in defaultAlgorithms)
            {
                if (algo != null)
                {
                    validAlgorithms[index++] = algo;
                }
            }
            return(RuntimeUtil.ConcatStrArray(validAlgorithms, ';'));
        }