Exemple #1
0
        public override void Bad()
        {
            string data;

            /* FLAW: Set data to a hardcoded value */
            data = "23 ~j;asn!@#/>as";
            Hashtable dataHashtable = new Hashtable(5);

            dataHashtable.Add(0, data);
            dataHashtable.Add(1, data);
            dataHashtable.Add(2, data);
            CWE321_Hard_Coded_Cryptographic_Key__basic_72b.BadSink(dataHashtable);
        }
Exemple #2
0
        /* goodG2B() - use goodsource and badsink */
        private static void GoodG2B()
        {
            string data;

            data = ""; /* Initialize data */
            /* read user input from console with readLine */
            try
            {
                /* FIX: Read data from the console using readLine() */
                data = Console.ReadLine();
            }
            catch (IOException exceptIO)
            {
                IO.Logger.Log(NLog.LogLevel.Warn, "Error with stream reading", exceptIO);
            }
            Hashtable dataHashtable = new Hashtable(5);

            dataHashtable.Add(0, data);
            dataHashtable.Add(1, data);
            dataHashtable.Add(2, data);
            CWE321_Hard_Coded_Cryptographic_Key__basic_72b.GoodG2BSink(dataHashtable);
        }