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)

(cherry picked from commit 1d69336)

# Conflicts:
#	dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs
#	dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs
  • Loading branch information
claudiamurialdo committed Jan 26, 2024
1 parent 01f5589 commit 93f815a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 34 deletions.
7 changes: 6 additions & 1 deletion dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,7 @@ protected virtual void ValidateSpaRequest()
sendSpaHeaders();
}
}
#if !NETCORE

protected string GetEncryptedHash(string value, string key)
{
Expand Down Expand Up @@ -1405,7 +1406,11 @@ protected String Decrypt64(String value, String key)
}
return sRet;
}

protected string UriDecrypt64(string value, string key)
{
return Decrypt64(value, key, true);
}
#endif
protected string DecryptAjaxCall(string encrypted)
{
this.validEncryptedParm = false;
Expand Down
44 changes: 43 additions & 1 deletion 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;
public virtual IGxContext context
Expand Down Expand Up @@ -102,7 +106,45 @@ 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)
{
string sRet = string.Empty;
try
{
sRet = Crypto.Encrypt64(value, key);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriEncrypt64(string value, string key)
{
return Encrypt64(value, key);
}

protected string Decrypt64(string value, string key)
{
String sRet = string.Empty;
try
{
sRet = Crypto.Decrypt64(value, key);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}
protected string UriDecrypt64(string value, string key)
{
return Decrypt64(value, key);
}
}
}
32 changes: 0 additions & 32 deletions dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,38 +107,6 @@ protected void exitApplication()
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)
{
String sRet = "";
try
{
sRet = Crypto.Encrypt64(value, key);
}
catch (InvalidKeyException)
{
GXLogging.Error(log, "440 Invalid encryption key");
}
return sRet;
}

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

0 comments on commit 93f815a

Please sign in to comment.