Skip to content

Commit 89b1fa5

Browse files
Move functions to super class so they are visible from BC transactions. (#609)
(cherry picked from commit 1d69336)
1 parent 420ae01 commit 89b1fa5

File tree

3 files changed

+54
-51
lines changed

3 files changed

+54
-51
lines changed

dotnet/src/dotnetframework/GxClasses/Middleware/GXHttp.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,7 @@ protected virtual void ValidateSpaRequest()
14051405
sendSpaHeaders();
14061406
}
14071407
}
1408+
#if !NETCORE
14081409

14091410
protected string GetEncryptedHash(string value, string key)
14101411
{
@@ -1457,7 +1458,7 @@ protected string UriDecrypt64(string value, string key)
14571458
{
14581459
return Decrypt64(value, key, true);
14591460
}
1460-
1461+
#endif
14611462
protected string DecryptAjaxCall(string encrypted)
14621463
{
14631464
this.validEncryptedParm = false;

dotnet/src/dotnetframework/GxClasses/Model/GXBaseObject.cs

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
using GeneXus.Diagnostics;
2+
using GeneXus.Encryption;
13
using GeneXus.Http;
24
using GeneXus.Utils;
35
using Jayrock.Json;
6+
using log4net;
47
#if NETCORE
58
using Microsoft.AspNetCore.Http.Extensions;
69
#endif
@@ -12,6 +15,7 @@ namespace GeneXus.Application
1215

1316
public class GXBaseObject
1417
{
18+
static readonly ILog log = log4net.LogManager.GetLogger(typeof(GXBaseObject));
1519
private Dictionary<string, string> callTargetsByObject = new Dictionary<string, string>();
1620
protected IGxContext _Context;
1721
bool _isMain;
@@ -21,7 +25,7 @@ public virtual IGxContext context
2125
{
2226
set { _Context = value; }
2327
get { return _Context; }
24-
28+
2529
}
2630
public bool IsMain
2731
{
@@ -120,7 +124,53 @@ public virtual string UrlEncode(string s)
120124
{
121125
return GXUtil.UrlEncode(s);
122126
}
127+
protected string GetEncryptedHash(string value, string key)
128+
{
129+
return Encrypt64(GXUtil.GetHash(GeneXus.Web.Security.WebSecurityHelper.StripInvalidChars(value), Cryptography.Constants.SecurityHashAlgorithm), key);
130+
}
123131

124-
}
132+
protected string Encrypt64(string value, string key)
133+
{
134+
return Encrypt64(value, key, false);
135+
}
136+
private string Encrypt64(string value, string key, bool safeEncoding)
137+
{
138+
string sRet = string.Empty;
139+
try
140+
{
141+
sRet = Crypto.Encrypt64(value, key, safeEncoding);
142+
}
143+
catch (InvalidKeyException)
144+
{
145+
GXLogging.Error(log, "440 Invalid encryption key");
146+
}
147+
return sRet;
148+
}
149+
protected string UriEncrypt64(string value, string key)
150+
{
151+
return Encrypt64(value, key, true);
152+
}
125153

154+
protected string Decrypt64(string value, string key)
155+
{
156+
return Decrypt64(value, key, false);
157+
}
158+
private string Decrypt64(string value, string key, bool safeEncoding)
159+
{
160+
String sRet = string.Empty;
161+
try
162+
{
163+
sRet = Crypto.Decrypt64(value, key, safeEncoding);
164+
}
165+
catch (InvalidKeyException)
166+
{
167+
GXLogging.Error(log, "440 Invalid encryption key");
168+
}
169+
return sRet;
170+
}
171+
protected string UriDecrypt64(string value, string key)
172+
{
173+
return Decrypt64(value, key, true);
174+
}
175+
}
126176
}

dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -122,54 +122,6 @@ private void exitApplication(bool flushBatchCursor)
122122
protected virtual void printHeaders(){}
123123
protected virtual void printFooters(){}
124124

125-
protected string GetEncryptedHash(string value, string key)
126-
{
127-
return Encrypt64(GXUtil.GetHash(GeneXus.Web.Security.WebSecurityHelper.StripInvalidChars(value), Cryptography.Constants.SecurityHashAlgorithm), key);
128-
}
129-
130-
protected string Encrypt64(string value, string key)
131-
{
132-
return Encrypt64(value, key, false);
133-
}
134-
private string Encrypt64(string value, string key, bool safeEncoding)
135-
{
136-
string sRet = string.Empty;
137-
try
138-
{
139-
sRet = Crypto.Encrypt64(value, key, safeEncoding);
140-
}
141-
catch (InvalidKeyException)
142-
{
143-
GXLogging.Error(log, "440 Invalid encryption key");
144-
}
145-
return sRet;
146-
}
147-
protected string UriEncrypt64(string value, string key)
148-
{
149-
return Encrypt64(value, key, true);
150-
}
151-
152-
protected string Decrypt64(string value, string key)
153-
{
154-
return Decrypt64(value, key, false);
155-
}
156-
private string Decrypt64(string value, string key, bool safeEncoding)
157-
{
158-
String sRet = string.Empty;
159-
try
160-
{
161-
sRet = Crypto.Decrypt64(value, key, safeEncoding);
162-
}
163-
catch (InvalidKeyException)
164-
{
165-
GXLogging.Error(log, "440 Invalid encryption key");
166-
}
167-
return sRet;
168-
}
169-
protected string UriDecrypt64(string value, string key)
170-
{
171-
return Decrypt64(value, key, true);
172-
}
173125
public msglist GX_msglist
174126
{
175127
get { return context.GX_msglist ; }

0 commit comments

Comments
 (0)