private static void buildSeeds(object _params)
        {
            string          sVendorSerial    = null;
            long            _ntotalCreated   = 0;
            int             seed             = RandomGen.Next();
            InMemoryLogging loggerMatrixFile = null;
            long            _nRequest        = (long)((object[])_params)[1];
            string          _nSerie          = (string)((object[])_params)[2];
            string          _outInf          = "/Process:" + Thread.CurrentThread.GetHashCode().ToString() + " /thread:" + ((string)((object[])_params)[3]).Trim() + " /processing:" + _nRequest.ToString().Trim() + "/{0} ";
            ArrayList       _vSm             = (ArrayList)((object[])_params)[4];
            string          _masterKey       = SAFConfiguration.readMasterKey();

            TokenCryptoData     _TokenCryptoData;
            TokenTypeBaseParams _tkParams = (TokenTypeBaseParams)((object[])_params)[0];
            InMemoryLogging     logger    = InMemoryLogging.GetLogString(cBASE_FILE_NAME + "." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);

            logger.MaxChars = -1;


            if (_tkParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
            {
                loggerMatrixFile          = InMemoryLogging.GetLogString(cBASE_FILE_NAME_MATRIX + "." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
                loggerMatrixFile.MaxChars = -1;
            }

            for (int i = 0; i < _nRequest; i++)
            {
                while (true)
                {
                    sVendorSerial = new Random(seed++).NextDouble().ToString();
                    sVendorSerial = sVendorSerial.Substring(sVendorSerial.Length - 12);

                    lock (_vSm)
                    {
                        if (!_vSm.Contains((object)sVendorSerial))
                        {
                            _vSm.Add((object)sVendorSerial);
                            break;
                        }
                    }
                }

                if (OperationResult.Success == TokensBaseFunctions.TokensCreateNew(_tkParams, _masterKey, sVendorSerial, "", out _TokenCryptoData))
                {
                    logger.Add(BaseImportExportTokens.Export(_TokenCryptoData, _nSerie));
                    if (_tkParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
                    {
                        loggerMatrixFile.Add(sVendorSerial + ";" + string.Join(";", TokensBaseFunctions.tokenTANMatrixArrayFetch(_TokenCryptoData, _masterKey, "")));
                    }
                    _ntotalCreated += 1;
                }
            }
            logger.Persist();
            if (loggerMatrixFile != null)
            {
                loggerMatrixFile.Persist();
            }
        }
Example #2
0
        private static void buildSeeds(object _params)
        {
            string          text            = null;
            long            num             = 0L;
            int             num2            = RandomGen.Next();
            InMemoryLogging inMemoryLogging = null;
            long            num3            = (long)((object[])_params)[1];
            string          loteID          = (string)((object[])_params)[2];

            string.Concat(new string[]
            {
                "/Process:",
                Thread.CurrentThread.GetHashCode().ToString(),
                " /thread:",
                ((string)((object[])_params)[3]).Trim(),
                " /processing:",
                num3.ToString().Trim(),
                "/{0} "
            });
            ArrayList           arrayList        = (ArrayList)((object[])_params)[4];
            string              masterKey        = SAFConfiguration.readMasterKey();
            TokenTypeBaseParams tkTypeBaseParams = (TokenTypeBaseParams)((object[])_params)[0];
            InMemoryLogging     logString        = InMemoryLogging.GetLogString("seedsThread." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);

            logString.MaxChars = -1;
            if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
            {
                inMemoryLogging          = InMemoryLogging.GetLogString("seedsThreadMatrix." + ((string)((object[])_params)[3]).PadLeft(3, '0'), false);
                inMemoryLogging.MaxChars = -1;
            }
            int num4 = 0;

            while ((long)num4 < num3)
            {
                while (true)
                {
                    text = new Random(num2++).NextDouble().ToString();
                    text = text.Substring(text.Length - 12);
                    ArrayList obj;
                    Monitor.Enter(obj = arrayList);
                    try
                    {
                        if (arrayList.Contains(text))
                        {
                            continue;
                        }
                        arrayList.Add(text);
                    }
                    finally
                    {
                        Monitor.Exit(obj);
                    }
                    break;
                }
                TokenCryptoData tokenCryptoData;
                if (TokensBaseFunctions.TokensCreateNew(tkTypeBaseParams, masterKey, text, "", out tokenCryptoData) == OperationResult.Success)
                {
                    logString.Add(BaseImportExportTokens.Export(tokenCryptoData, loteID));
                    if (tkTypeBaseParams.MovingFactorType == TokenMovingFactorType.TransactionAuthenticationNumber)
                    {
                        inMemoryLogging.Add(text + ";" + string.Join(";", TokensBaseFunctions.tokenTANMatrixArrayFetch(tokenCryptoData, masterKey, "")));
                    }
                    num += 1L;
                }
                num4++;
            }
            logString.Persist();
            if (inMemoryLogging != null)
            {
                inMemoryLogging.Persist();
            }
        }