コード例 #1
0
        public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
        {
            string          _tokenBlob = null;
            OperationResult result;

            if (pin == null || (pin ?? "").Length < 2)
            {
                tokenInfoCore = new TokenInfoCore();
                result        = OperationResult.Error;
            }
            else
            {
                OperationResult _hResult = new TokensDAO().newTokenFromPreInsertedSeed(tokenVendorID, TokenStatus.ReadyToDeploy, out tokenInfoCore);
                if (_hResult == OperationResult.Success)
                {
                    IBLOBData _blobProcessor = BLOBDataFactory.LoadAssembly("SF.Expand.SAF.Blobs.BLOBStructInfSrv, SF.Expand.SAF.Blobs");
                    if (_blobProcessor.Export(pin, "J1", null, new TokensDAO().loadTokenCryptoData(tokenInfoCore.InternalID.ToString()), out _tokenBlob))
                    {
                        if (OperationResult.Success != new TokensDAO().updateCryptoData(tokenInfoCore.InternalID.ToString(), _tokenBlob))
                        {
                            this.UndoCreate(tokenInfoCore.InternalID.ToString());
                            _hResult = OperationResult.Error;
                        }
                    }
                }
                result = _hResult;
            }
            return(result);
        }
コード例 #2
0
        public OperationResult newTokenFromPreInsertedSeed(string tokenParamsID, out TokenInfoCore tokenInfoCore)
        {
            IDbCommand dbCommand = null;

            tokenInfoCore = new TokenInfoCore();
            OperationResult result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSAFCore();
                dbCommand             = base.CreateCommand("FreeSeedUpdateForNewToken", CommandType.StoredProcedure);
                dbCommand.Parameters.Add(base.AddParameter("@Param0", 1));
                dbCommand.Parameters.Add(base.AddParameter("@Param1", 99));
                dbCommand.Parameters.Add(base.AddParameter("@Param2", tokenParamsID));
                base.Connection.Open();
                object obj = dbCommand.ExecuteScalar();
                if (obj == DBNull.Value)
                {
                    result = OperationResult.Error;
                }
                else
                {
                    if (obj.ToString() == "0")
                    {
                        result = OperationResult.TokenVendorSeedNotAvaliable;
                    }
                    else
                    {
                        tokenInfoCore = this.loadTokenInfoCore(obj.ToString());
                        result        = OperationResult.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, string.Concat(new string[]
                {
                    "SF.Expand.SAF.Core.TokensDAO::newTokenFromPreInsertedSeed[",
                    tokenParamsID,
                    "]",
                    Environment.NewLine,
                    ex.ToString()
                }), null);
                result = OperationResult.Error;
            }
            finally
            {
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
コード例 #3
0
        public OperationResult newTokenFromGivenSupplierSerialNumber(string tokenParamsID, string SupplierSerialNumber, out TokenInfoCore tokenInfoCore)
        {
            IDbCommand _cmd = null;

            tokenInfoCore = new TokenInfoCore();
            OperationResult result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSAFCore();
                _cmd = base.CreateCommand("GivenSupplierSerialNumberUpdateForNewToken", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@Param0", 1));
                _cmd.Parameters.Add(base.AddParameter("@Param1", 99));
                _cmd.Parameters.Add(base.AddParameter("@Param2", tokenParamsID));
                _cmd.Parameters.Add(base.AddParameter("@Param3", SupplierSerialNumber));
                base.Connection.Open();
                object _retID = _cmd.ExecuteScalar();
                if (_retID == DBNull.Value || (int)_retID == 0)
                {
                    SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.WARNING, "SAFCORE", new string[]
                    {
                        "http://sfexpand.SAFCore.TokensDAO.softfinanca.com/newTokenFromGivenSupplierSerialNumber",
                        OperationResult.TokenVendorSeedNotAvaliable.ToString()
                    });
                    result = OperationResult.TokenVendorSeedNotAvaliable;
                }
                else
                {
                    tokenInfoCore = this.loadTokenInfoCore(_retID.ToString());
                    result        = OperationResult.Success;
                }
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
コード例 #4
0
        public OperationResult createToken(string tokenParamsID, long movingFactor, DateTime expirationDate, string cryptoKey, string supplierSerialNumber, string internalSerialNumber, string creationLotID, string SupportCryptoData, out TokenInfoCore tokenInfoCore)
        {
            string          tokenID = null;
            IDbCommand      _cmd    = null;
            OperationResult result;

            tokenInfoCore = new TokenInfoCore();

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSAFCore();
                _cmd = base.CreateCommand("InsertNewToken", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@tkStatus", 0));
                _cmd.Parameters.Add(base.AddParameter("@tkParamsID", tokenParamsID));
                _cmd.Parameters.Add(base.AddParameter("@tkMovingFactor", movingFactor));
                _cmd.Parameters.Add(base.AddParameter("@tkExpirationDate", expirationDate));
                _cmd.Parameters.Add(base.AddParameter("@tkCryptoKey", cryptoKey));
                _cmd.Parameters.Add(base.AddParameter("@tkCreationLotID", creationLotID));
                _cmd.Parameters.Add(base.AddParameter("@tkSupplierSerialNumber", supplierSerialNumber));
                _cmd.Parameters.Add(base.AddParameter("@tkInternalSerialNumber", internalSerialNumber));
                _cmd.Parameters.Add(base.AddParameter("@tkSupportCriptoData", SupportCryptoData));
                _cmd.Parameters.Add(base.AddParameter("@tokenSubLotID", null));
                base.Connection.Open();
                long _hResult = long.Parse(_cmd.ExecuteScalar().ToString());
                tokenID       = _hResult.ToString();
                tokenInfoCore = this.loadTokenInfoCore(tokenID);
                result        = OperationResult.Success;
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
コード例 #5
0
        public TokenInfoCore loadTokenInfoCore(string tokenID)
        {
            IDataReader   dataReader = null;
            IDbCommand    dbCommand  = null;
            TokenInfoCore result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSAFCore();
                dbCommand             = base.CreateCommand("GetTokenInfoByID", CommandType.StoredProcedure);
                dbCommand.Parameters.Add(base.AddParameter("@tkID", tokenID));
                base.OpenConnection();
                dataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConnection);
                dataReader.Read();
                result = TokenInfoCore.loadTokenInfoCore((byte)dataReader[0], (int)dataReader[1], (string)dataReader[2], (string)dataReader[3], (string)dataReader[4], (dataReader[5] != DBNull.Value) ? ((DateTime)dataReader[5]) : DateTime.MinValue, (string)dataReader[7], (TokenStatus)((byte)dataReader[6]));
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, string.Concat(new string[]
                {
                    "SF.Expand.SAF.Core.TokensDAO::loadTokenInfo[",
                    tokenID,
                    "]",
                    Environment.NewLine,
                    ex.ToString()
                }), null);
                result = new TokenInfoCore();
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Dispose();
                }
                if (dbCommand != null)
                {
                    dbCommand.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
コード例 #6
0
        public TokenInfoCore loadTokenInfoCore(string tokenID)
        {
            IDataReader   _rd  = null;
            IDbCommand    _cmd = null;
            TokenInfoCore result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSAFCore();
                _cmd = base.CreateCommand("GetTokenInfoByID", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@tkID", tokenID));
                base.OpenConnection();
                _rd = _cmd.ExecuteReader(CommandBehavior.CloseConnection);
                _rd.Read();
                result = TokenInfoCore.loadTokenInfoCore((byte)_rd[0], (int)_rd[1], (_rd[2] != DBNull.Value) ? ((string)_rd[2]) : "", (_rd[3] != DBNull.Value) ? ((string)_rd[3]) : "", (string)_rd[4], (_rd[5] != DBNull.Value) ? ((DateTime)_rd[5]) : DateTime.MinValue, (_rd[7] == DBNull.Value) ? null : _rd[7].ToString(), (TokenStatus)((byte)_rd[6]));
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.TokensDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = new TokenInfoCore();
            }
            finally
            {
                if (_rd != null)
                {
                    _rd.Dispose();
                }
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
コード例 #7
0
        public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
        {
            tokenInfoCore = new TokenInfoCore();
            OperationResult result;

            try
            {
                string  assemb  = new TokensValidatorDAO().DeployAssemblyNameByTokenParamsID(tokenVendorID);
                ITokens _tokens = TokensFactory.LoadAssembly(assemb);
                if (_tokens == null)
                {
                    SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.ERROR, "SAFCORE", new string[]
                    {
                        "http://sfexpand.SAFCore.PREProcessorTokens.softfinanca.com/",
                        "[ITokens]::" + assemb.Trim(),
                        "Invalid or null typename!"
                    });
                    tokenInfoCore = new TokenInfoCore();
                    result        = OperationResult.Error;
                }
                else
                {
                    result = _tokens.Create(tokenVendorID, expirationDate, supplierSerialNumber, creationLotID, pin, out tokenInfoCore);
                }
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFCORE", new string[]
                {
                    "http://sfexpand.SAFCore.PREProcessorTokens.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                tokenInfoCore = new TokenInfoCore();
                result        = OperationResult.Error;
            }
            return(result);
        }
コード例 #8
0
        public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
        {
            OperationResult result;

            try
            {
                string  typeName = new TokensValidatorDAO().DeployAssemblyNameByTokenParamsID(tokenVendorID);
                ITokens tokens   = TokensFactory.LoadAssembly(typeName);
                result = tokens.Create(tokenVendorID, expirationDate, supplierSerialNumber, creationLotID, pin, out tokenInfoCore);
            }
            catch (Exception innerException)
            {
                throw new Exception("SF.Expand.SAF.Core.PREProcessorTokens::Create[]", innerException);
            }
            return(result);
        }
コード例 #9
0
 public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
 {
     return(new TokensDAO().newTokenFromPreInsertedSeed(tokenVendorID, out tokenInfoCore));
 }
コード例 #10
0
 public OperationResult newTokenFromPreInsertedSeed(string tokenParamsID, out TokenInfoCore tokenInfoCore)
 {
     return(this.newTokenFromPreInsertedSeed(tokenParamsID, TokenStatus.Enabled, out tokenInfoCore));
 }
コード例 #11
0
        public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
        {
            //string criptoKey = "";
            //long movingFactor = 0;
            //string internalSerialNumber = "";
            //string supportCriptoData = null;


            ////SF.Expand.SAF.Core.TokensBaseFunctions.TokensCreateNew(TokenSeedType.Dynamic,"", "", null,,

            //return new TokensDAO().createToken(tokenVendorID, movingFactor, expirationDate, criptoKey, supplierSerialNumber, internalSerialNumber, creationLotID, supportCriptoData, out tokenInfoCore);

            return(new TokensDAO().newTokenFromGivenSupplierSerialNumber(tokenVendorID, supplierSerialNumber, out tokenInfoCore));
        }