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;
		}
		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);

		}
		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;
		}
Exemplo n.º 4
0
		public static TokenInfo loadTokenInfo(TokenStatus status, byte typeID, int internalID, string typeDescription, string applicationUser, string phoneNumberUser, string emailAddressUser, DateTime registeredTimeStamp, string internalSerialNumber, DateTime lastStatusTimeStamp, TokenInfoCore tokenInfoCore)
		{
			TokenInfo _newTkInfoBus = new TokenInfo();
			_newTkInfoBus.Status = status;
			_newTkInfoBus.TypeDescription = ((typeDescription == null) ? null : typeDescription.Trim());
			_newTkInfoBus.ApplicationUser = ((applicationUser == null) ? null : applicationUser.Trim());
			_newTkInfoBus.PhoneNumberUser = ((phoneNumberUser == null) ? null : phoneNumberUser.Trim());
			_newTkInfoBus.EmailAddressUser = ((emailAddressUser == null) ? null : emailAddressUser.Trim());
			_newTkInfoBus.RegisteredTimeStamp = registeredTimeStamp;
			_newTkInfoBus.LastStatusChangedTimeStamp = lastStatusTimeStamp;
			if (tokenInfoCore.InternalID == 0)
			{
				_newTkInfoBus.tokenInfoCore = TokenInfoCore.loadTokenInfoCore(typeID, internalID, null, null, internalSerialNumber, registeredTimeStamp, null, status);
			}
			else
			{
				_newTkInfoBus.tokenInfoCore = tokenInfoCore;
			}
			return _newTkInfoBus;
		}
Exemplo n.º 5
0
        public static TokenInfo loadTokenInfo(TokenStatus status, byte typeID, int internalID, string typeDescription, string applicationUser, string phoneNumberUser, string emailAddressUser, DateTime registeredTimeStamp, string internalSerialNumber, DateTime lastStatusTimeStamp, TokenInfoCore tokenInfoCore)
        {
            TokenInfo _newTkInfoBus = new TokenInfo();

            _newTkInfoBus.Status                     = status;
            _newTkInfoBus.TypeDescription            = ((typeDescription == null) ? null : typeDescription.Trim());
            _newTkInfoBus.ApplicationUser            = ((applicationUser == null) ? null : applicationUser.Trim());
            _newTkInfoBus.PhoneNumberUser            = ((phoneNumberUser == null) ? null : phoneNumberUser.Trim());
            _newTkInfoBus.EmailAddressUser           = ((emailAddressUser == null) ? null : emailAddressUser.Trim());
            _newTkInfoBus.RegisteredTimeStamp        = registeredTimeStamp;
            _newTkInfoBus.LastStatusChangedTimeStamp = lastStatusTimeStamp;
            if (tokenInfoCore.InternalID == 0)
            {
                _newTkInfoBus.tokenInfoCore = TokenInfoCore.loadTokenInfoCore(typeID, internalID, null, null, internalSerialNumber, registeredTimeStamp, null, status);
            }
            else
            {
                _newTkInfoBus.tokenInfoCore = tokenInfoCore;
            }
            return(_newTkInfoBus);
        }
		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;
		}
		public OperationResult Create(string tokenVendorID, DateTime expirationDate, string supplierSerialNumber, string creationLotID, string pin, out TokenInfoCore tokenInfoCore)
		{
			return new TokensDAO().newTokenFromGivenSupplierSerialNumber(tokenVendorID, supplierSerialNumber, out tokenInfoCore);
		}
		public TokenInfo getTokenInfo(string tokenID, TokenInfoCore tokenInfoCore)
		{
			IDataReader _dr = null;
			IDbCommand _cmd = null;
			TokenInfo result;
			try
			{
				base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
				_cmd = base.CreateCommand("GetTokenInfo", CommandType.StoredProcedure);
				_cmd.Parameters.Add(base.AddParameter("@Param1", tokenID));
				base.OpenConnection();
				(_dr = _cmd.ExecuteReader(CommandBehavior.CloseConnection)).Read();
				result = TokenInfo.loadTokenInfo((TokenStatus)((byte)_dr[2]), (byte)_dr[7], (int)_dr[0], (_dr[5] == DBNull.Value) ? "" : ((string)_dr[5]), (string)_dr[1], (_dr[3] == DBNull.Value) ? "" : ((string)_dr[3]), (_dr[6] == DBNull.Value) ? "" : ((string)_dr[6]), (DateTime)_dr[4], (string)_dr[8], (DateTime)_dr[11], tokenInfoCore);
			}
			catch (Exception ex)
			{
				SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					ex.ToString()
				});
				result = new TokenInfo();
			}
			finally
			{
				if (_dr != null)
				{
					_dr.Dispose();
				}
				if (_cmd != null)
				{
					_cmd.Dispose();
				}
				base.CloseConnection();
			}
			return result;
		}
		public OperationResult insertTokenUser(TokenInfoCore tokenInfoCore, string applicationUser, string applicationPhoneNumber, string applicationEmail, out TokenInfo tokenInfo, out long tokenEventID)
		{
			tokenEventID = 0L;
			IDbCommand _cmd = null;
			tokenInfo = new TokenInfo();
			OperationResult result;
			try
			{
				base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
				_cmd = base.CreateCommand("TokenUserInsert", CommandType.StoredProcedure);
				_cmd.Parameters.Add(base.AddParameter("@param1", tokenInfoCore.InternalID));
				_cmd.Parameters.Add(base.AddParameter("@param2", tokenInfoCore.TypeID));
				_cmd.Parameters.Add(base.AddParameter("@param3", tokenInfoCore.InternalStatus));
				_cmd.Parameters.Add(base.AddParameter("@param4", applicationUser));
				_cmd.Parameters.Add(base.AddParameter("@param5", applicationPhoneNumber));
				_cmd.Parameters.Add(base.AddParameter("@param6", applicationEmail));
				_cmd.Parameters.Add(base.AddParameter("@param7", tokenInfoCore.InternalSerialNumber));
				_cmd.Parameters.Add(base.AddParameter("@param8", tokenInfoCore.SupplierSerialNumber));
				_cmd.Parameters.Add(base.AddParameter("@param9", tokenInfoCore.SupplierLotID));
				base.Connection.Open();
				base.TransactionBegin(IsolationLevel.ReadCommitted);
				_cmd.Transaction = base.Transaction;
				if (1 == _cmd.ExecuteNonQuery())
				{
					if (OperationResult.Success == this._insertTokenEvent(tokenInfoCore.InternalID.ToString(), 100, 0, applicationUser, out tokenEventID))
					{
						if (tokenInfoCore.InternalStatus == TokenStatus.ReadyToDeploy)
						{
							if (OperationResult.Success != this._insertTokenEvent(tokenInfoCore.InternalID.ToString(), 98, 0, applicationUser, out tokenEventID))
							{
								result = OperationResult.Error;
								return result;
							}
						}
						base.TransactionCommit();
						tokenInfo = this.getTokenInfo(tokenInfoCore.InternalID.ToString(), tokenInfoCore);
						result = OperationResult.Success;
						return result;
					}
				}
				result = OperationResult.Error;
			}
			catch (Exception ex)
			{
				SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
				{
					"http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
					Assembly.GetExecutingAssembly().FullName.ToString(),
					ex.ToString()
				});
				result = OperationResult.Error;
			}
			finally
			{
				if (_cmd != null)
				{
					_cmd.Dispose();
				}
				base.CloseConnection();
			}
			return result;
		}
Exemplo n.º 10
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;
		}
Exemplo n.º 11
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;
		}
Exemplo n.º 12
0
		public OperationResult newTokenFromPreInsertedSeed(string tokenParamsID, TokenStatus newTokenStatus, out TokenInfoCore tokenInfoCore)
		{
			IDbCommand _cmd = null;
			tokenInfoCore = new TokenInfoCore();
			OperationResult result;
			try
			{
				base.ConnectionString = DBConnectionString.ExpandSAFCore();
				_cmd = base.CreateCommand("FreeSeedUpdateForNewToken", CommandType.StoredProcedure);
				_cmd.Parameters.Add(base.AddParameter("@Param0", (byte)newTokenStatus));
				_cmd.Parameters.Add(base.AddParameter("@Param1", 99));
				_cmd.Parameters.Add(base.AddParameter("@Param2", tokenParamsID));
				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/newTokenFromPreInsertedSeed",
						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;
		}
Exemplo n.º 13
0
		public OperationResult newTokenFromPreInsertedSeed(string tokenParamsID, out TokenInfoCore tokenInfoCore)
		{
			return this.newTokenFromPreInsertedSeed(tokenParamsID, TokenStatus.Enabled, out tokenInfoCore);
		}
Exemplo n.º 14
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;
		}
Exemplo n.º 15
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;
		}