Beispiel #1
0
        public static DrbgAttributes GetDrbgAttributes(string mechanism, string mode, bool derivationFunction = false)
        {
            DrbgAttributes result = null;

            if (derivationFunction)
            {
                if (!DrbgAttributesWithDerFunc
                    .TryFirst(w => w.MechanismAsString.Equals(mechanism, StringComparison.OrdinalIgnoreCase) &&
                              w.ModeAsString.Equals(mode, StringComparison.OrdinalIgnoreCase), out result))
                {
                    throw new ArgumentException("Invalid mechanism and/or mode");
                }
            }
            else
            {
                if (!DrbgAttributesWithoutDerFunc
                    .TryFirst(w => w.MechanismAsString.Equals(mechanism, StringComparison.OrdinalIgnoreCase) &&
                              w.ModeAsString.Equals(mode, StringComparison.OrdinalIgnoreCase), out result))
                {
                    throw new ArgumentException("Invalid mechanism and/or mode");
                }
            }

            return(result);
        }
Beispiel #2
0
        public static DrbgAttributes GetDrbgAttributes(DrbgMechanism mechanism, DrbgMode mode, bool derivationFunction = false)
        {
            DrbgAttributes result = null;

            if (derivationFunction)
            {
                if (!DrbgAttributesWithDerFunc.TryFirst(w => w.Mechanism == mechanism && w.Mode == mode, out result))
                {
                    throw new ArgumentException("Invalid mechanism and/or mode");
                }
            }
            else
            {
                if (!DrbgAttributesWithoutDerFunc.TryFirst(w => w.Mechanism == mechanism && w.Mode == mode, out result))
                {
                    throw new ArgumentException("Invalid mechanism and/or mode");
                }
            }

            return(result);
        }