コード例 #1
0
        public static OperationResult tokenTANMatrixIntegrityCheck(TokenCryptoData tokenCryptoData, byte[] tkSeed, byte[] entropy, out string SupportCriptoData)
        {
            string          _TanMatrixChallenge = string.Empty;
            OperationResult result;

            try
            {
                string[] _matriz = new string[tokenCryptoData.TokenBaseParams.OTPValidationWindow];
                for (int _idx = 0; _idx < tokenCryptoData.TokenBaseParams.OTPValidationWindow; _idx++)
                {
                    bool _flag;
                    do
                    {
                        _flag = false;
                        tokenCryptoData.ResetMovingFactor(tokenCryptoData.CryptoData.MovingFactor + tokenCryptoData.TokenBaseParams.HOTPMovingFactorDrift);
                        _matriz[_idx] = HOTPPwdGenerator.generate(tokenCryptoData, tkSeed, new byte[0]);
                        for (int _idx2 = 0; _idx2 < _idx; _idx2++)
                        {
                            if (_matriz[_idx] == _matriz[_idx2])
                            {
                                _flag = true;
                                break;
                            }
                        }
                    }while (_flag);
                    _TanMatrixChallenge = _TanMatrixChallenge + _matriz[_idx] + ";";
                }
                SupportCriptoData = BaseFunctions.EncodeTo64(_TanMatrixChallenge.Substring(0, _TanMatrixChallenge.Length - 1));
                result            = OperationResult.Success;
            }
            catch (Exception ex)
            {
                SupportCriptoData = null;
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensBaseFunctions.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
            }
            return(result);
        }
コード例 #2
0
        public static OperationResult tokenTANMatrixIntegrityCheck(TokenCryptoData tokenCryptoData, byte[] tkSeed, byte[] entropy, out string SupportCriptoData)
        {
            OperationResult result;

            try
            {
                string   text  = string.Empty;
                string[] array = new string[tokenCryptoData.TokenBaseParams.OTPValidationWindow];
                for (int i = 0; i < tokenCryptoData.TokenBaseParams.OTPValidationWindow; i++)
                {
                    bool flag;
                    do
                    {
                        flag = false;
                        tokenCryptoData.ResetMovingFactor(tokenCryptoData.CryptoData.MovingFactor + tokenCryptoData.TokenBaseParams.HOTPMovingFactorDrift);
                        array[i] = HOTPPwdGenerator.generate(tokenCryptoData, tkSeed, new byte[0]);
                        for (int j = 0; j < i; j++)
                        {
                            if (array[i] == array[j])
                            {
                                flag = true;
                                break;
                            }
                        }
                    }while (flag);
                    text = text + array[i] + ";";
                }
                SupportCriptoData = BaseFunctions.EncodeTo64(text.Substring(0, text.Length - 1));
                result            = OperationResult.Success;
            }
            catch
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Core::TANMatrixIntegrityCheck[]", null);
                SupportCriptoData = null;
                result            = OperationResult.Error;
            }
            return(result);
        }