Skip to content

Commit

Permalink
Move functions to super class so they are visible from BC transaction…
Browse files Browse the repository at this point in the history
…s. (#609)
  • Loading branch information
claudiamurialdo authored Jun 13, 2022
1 parent 28cf738 commit 1d69336
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 51 deletions.
3 changes: 2 additions & 1 deletion dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,7 @@ protected virtual void ValidateSpaRequest()
sendSpaHeaders();
}
}
#if !NETCORE

protected string GetEncryptedHash(string value, string key)
{
Expand Down Expand Up @@ -1457,7 +1458,7 @@ protected string UriDecrypt64(string value, string key)
{
return Decrypt64(value, key, true);
}

#endif
protected string DecryptAjaxCall(string encrypted)
{
this.validEncryptedParm = false;
Expand Down
54 changes: 52 additions & 2 deletions dotnet/src/dotnetframework/GxClasses/Model/GXBaseObject.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using GeneXus.Diagnostics;
using GeneXus.Encryption;
using GeneXus.Http;
using GeneXus.Utils;
using Jayrock.Json;
using log4net;
#if NETCORE
using Microsoft.AspNetCore.Http.Extensions;
#endif
Expand All @@ -12,6 +15,7 @@ namespace GeneXus.Application

public class GXBaseObject
{
static readonly ILog log = log4net.LogManager.GetLogger(typeof(GXBaseObject));
private Dictionary<string, string> callTargetsByObject = new Dictionary<string, string>();
protected IGxContext _Context;
bool _isMain;
Expand All @@ -21,7 +25,7 @@ public virtual IGxContext context
{
set { _Context = value; }
get { return _Context; }

}
public bool IsMain
{
Expand Down Expand Up @@ -120,7 +124,53 @@ public virtual string UrlEncode(string s)
{
return GXUtil.UrlEncode(s);
}
protected string GetEncryptedHash(string value, string key)
{
return Encrypt64(GXUtil.GetHash(GeneXus.Web.Security.WebSecurityHelper.StripInvalidChars(value), Cryptography.Constants.SecurityHashAlgorithm), key);
}

}
protected string Encrypt64(string value, string key)
{
return Encrypt64(value, key, false);
}
private string Encrypt64(string value, string key, bool safeEncoding)
{
string sRet = string.Empty;
try
{
sRet = Crypto.Encrypt64(value, key, safeEncoding);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriEncrypt64(string value, string key)
{
return Encrypt64(value, key, true);
}

protected string Decrypt64(string value, string key)
{
return Decrypt64(value, key, false);
}
private string Decrypt64(string value, string key, bool safeEncoding)
{
String sRet = string.Empty;
try
{
sRet = Crypto.Decrypt64(value, key, safeEncoding);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriDecrypt64(string value, string key)
{
return Decrypt64(value, key, true);
}
}
}
48 changes: 0 additions & 48 deletions dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,54 +122,6 @@ private void exitApplication(bool flushBatchCursor)
protected virtual void printHeaders(){}
protected virtual void printFooters(){}

protected string GetEncryptedHash(string value, string key)
{
return Encrypt64(GXUtil.GetHash(GeneXus.Web.Security.WebSecurityHelper.StripInvalidChars(value), Cryptography.Constants.SecurityHashAlgorithm), key);
}

protected string Encrypt64(string value, string key)
{
return Encrypt64(value, key, false);
}
private string Encrypt64(string value, string key, bool safeEncoding)
{
string sRet = string.Empty;
try
{
sRet = Crypto.Encrypt64(value, key, safeEncoding);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriEncrypt64(string value, string key)
{
return Encrypt64(value, key, true);
}

protected string Decrypt64(string value, string key)
{
return Decrypt64(value, key, false);
}
private string Decrypt64(string value, string key, bool safeEncoding)
{
String sRet = string.Empty;
try
{
sRet = Crypto.Decrypt64(value, key, safeEncoding);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriDecrypt64(string value, string key)
{
return Decrypt64(value, key, true);
}
public msglist GX_msglist
{
get { return context.GX_msglist ; }
Expand Down

0 comments on commit 1d69336

Please sign in to comment.