protected void CheckPinCodeInternal(CreditCard card, string pinCode) { string encripted = EncryptionService.Encrypt(pinCode, card.Salt); if (!card.PinCode.Equals(encripted)) throw new WrongPinCodeException(); }
public void CreateCreditCard(long ccNumber, string pinCode, double balance) { var cc = new CreditCard { Balance = balance, IsBlocked = false, CreditCardNumber = ccNumber, Salt = EncryptionService.GetSolt(), }; cc.PinCode = EncryptionService.Encrypt(pinCode, cc.Salt); Context.CreditCards.Add(cc); Context.SaveChanges(); }