private void EncodeDecode(string message, string key) { var encoded = AesEncryption.Encode(message, key); Assert.IsNotNull(encoded); Assert.AreNotEqual("", encoded); var decoded = AesEncryption.Decode(encoded, key); Assert.AreEqual(message, decoded); }
private string Decrypt(string input) { try { return(AesEncryption.Decode(input, KeyManager.GetKey(0))); } catch { } return(string.Empty); }
protected override void CopyDataToModel(hcc_OrderTransactions data, OrderTransaction model) { model.Action = (ActionType)data.Action; model.Amount = data.Amount; try { if (!string.IsNullOrWhiteSpace(data.GiftCard)) { model.GiftCard = Json.ObjectFromJson <GiftCardData>(data.GiftCard); } } catch { } try { var key = KeyManager.GetKey(0); if (data.CreditCard.Trim().Length > 2) { var json = AesEncryption.Decode(data.CreditCard, key); model.CreditCard = Json.ObjectFromJson <CardData>(json); } } catch { } var settingsJson = data.AdditionalSettings; model.AdditionalSettings = Json.ObjectFromJson <Dictionary <string, string> >(settingsJson); model.Id = data.Id; model.LinkedToTransaction = data.LinkedToTransaction; model.OrderId = DataTypeHelper.GuidToBvin(data.OrderId); model.OrderNumber = data.OrderNumber; model.RefNum1 = data.RefNum1; model.RefNum2 = data.RefNum2; model.StoreId = data.StoreId; model.Success = data.Success; model.TimeStampUtc = data.Timestamp; model.Voided = data.Voided; model.Messages = data.Messages; model.CheckNumber = data.CheckNumber; model.PurchaseOrderNumber = data.PurchaseOrderNumber; model.CompanyAccountNumber = data.CompanyAccountNumber; model.MethodId = data.MethodId; model.LineItemId = data.LineItemId; }
public TaxProviderSettings TaxProviderSettingsGet(string providerID) { try { var encrypted = GetProp("taxprovsetting" + providerID); if (encrypted.Length > 2) { var key = KeyManager.GetKey(0); var json = AesEncryption.Decode(encrypted, key); return(Json.ObjectFromJson <TaxProviderSettings>(json)); } } catch { } return(new TaxProviderSettings()); }
public MethodSettings GiftCardSettingsGet(string gcGatewayId) { try { var encrypted = GetProp("gcpaysettings" + gcGatewayId); if (encrypted.Length > 2) { var key = KeyManager.GetKey(0); var json = AesEncryption.Decode(encrypted, key); return(Json.ObjectFromJson <MethodSettings>(json)); } } catch { } return(new MethodSettings()); }
public TaxProviderSettings TaxProviderSettingsGet(string providerID) { try { var encrypted = GetProp(string.Concat(Constants.STORESETTING_TAXPROVIDERSETTING, providerID)); if (encrypted.Length > 2) { var key = KeyManager.GetKey(0); var json = AesEncryption.Decode(encrypted, key); return(Json.ObjectFromJson <TaxProviderSettings>(json)); } } catch { } return(new TaxProviderSettings()); }
public MethodSettings GiftCardSettingsGet(string gcGatewayId) { try { var encrypted = GetProp(string.Concat(Constants.STORESETTING_PAYMENTGIFTCARDSETTINGS, gcGatewayId)); if (encrypted.Length > 2) { var key = KeyManager.GetKey(0); var json = AesEncryption.Decode(encrypted, key); return(Json.ObjectFromJson <MethodSettings>(json)); } } catch { } return(new MethodSettings()); }
private string Decrypt(string input) { return(AesEncryption.Decode(input, KeyManager.GetKey(0))); }