Skip to content

Commit 3cd750f

Browse files
anaibertaBeta Bot
authored andcommitted
Revert branch 'genexuslabs:beta' into beta
1 parent 4596f4e commit 3cd750f

File tree

612 files changed

+8294
-29376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+8294
-29376
lines changed

.github/workflows/Build.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,32 @@ jobs:
179179
MAVEN_PASSWORD: ${{ secrets.MAVEN_OSSRH_TOKEN }}
180180
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_BUILDER_PASSPHRASE }}
181181

182-
update-genexus-dependency:
182+
dispatch-build:
183+
name: Dispatch build result
184+
needs: build
185+
if: github.repository_owner == 'GeneXusLabs' && needs.build.outputs.SHOULD_DEPLOY == 'true'
186+
187+
runs-on: ubuntu-latest
188+
183189
concurrency:
184190
group: build-${{ github.ref }}
185191
cancel-in-progress: true
186-
uses: genexuslabs/build-genexus-reusable-workflow/.github/workflows/update-genexus-dep-version.yml@main
187-
needs: build
188-
if: github.repository_owner == 'genexuslabs' && needs.build.outputs.SHOULD_DEPLOY == 'true'
189-
with:
190-
VERSION: ${{ needs.build.outputs.MAVEN_VERSION }}
191-
PACKAGE_NAMES: ${{ needs.build.outputs.PACKAGES_NAME }}
192-
COMMIT_MESSAGE: ${{ needs.build.outputs.COMMIT_MESSAGE }}
193-
COMMITTER: ${{ needs.build.outputs.LAST_COMMITTER }}
194-
secrets: inherit
192+
193+
steps:
194+
- name: Checkout action
195+
uses: actions/checkout@v2
196+
with:
197+
repository: genexuslabs/dispatch-build-result
198+
ref: releases/v2
199+
token: ${{ secrets.SECURE_TOKEN }}
200+
path: ./tmp/.github/actions/dispatch-build-result
201+
202+
- name: Dispatch build result
203+
uses: ./tmp/.github/actions/dispatch-build-result
204+
with:
205+
component-name: ${{ github.event.inputs.repository }}
206+
branch-ref: ${{ env.GIT_REF }}
207+
new-version: ${{ needs.build.outputs.MAVEN_VERSION }}
208+
committer: ${{ needs.build.outputs.LAST_COMMITTER }}
209+
commit-message: ${{ needs.build.outputs.COMMIT_MESSAGE }}
210+
token: ${{ secrets.SECURE_TOKEN }}

.github/workflows/call-beta-bot.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#vscode
2-
.vscode/
3-
41
# Maven
52
log/
63
target/
@@ -9,9 +6,6 @@ target/
96
.idea/
107
*.iml
118

12-
#VSCode
13-
.vscode/
14-
159
# Mac OS
1610
.DS_Store
1711

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
1212
| Name | Description
1313
|---|---
1414
| common | Classes common to Android and Java
15+
| gxcryptocommon | Classes common to Android and Java related to Cryptography
1516
| gxmail | Classes related to mail handling
1617
| java | Java standard classes, output is gxclassr.jar
1718
| wrappercommon | Interfaces to encapsulate Java EE and Jakarta EE support, output is gxwrappercommon.jar
@@ -24,15 +25,6 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
2425
| gxexternalproviders | Implements service provider for IBM Cloud, Google, Azure, Amazon
2526
| gxgeospatial | Geography data type implementation
2627
| gxodata | OData access
27-
| securityapicommons | SecurityAPI's common module
28-
| gxcryptography | SecurityAPI's GeneXusCryptography module
29-
| gxjwt | SecurityAPI's GeneXusJWT module
30-
| gxxmlsignature | SecurityAPI's GeneXusXmlSignature module
31-
| gxftps | SecurityAPI's GeneXusFTPS module
32-
| gxsftp | SecurityAPI's GeneXusSFTP module
33-
| gamsaml | GAM's External Object, SAML protocol implementation
34-
| gamutils | GAM external object with utilities
35-
| gamtotp | GAM external object for RFC6238 implementation
3628

3729
The dependencies between the projects are specified in each pom.xml within their directory.
3830

@@ -95,7 +87,3 @@ Once you compiled or packaged everything you needed, you can stop the container
9587
See the License for the specific language governing permissions and
9688
limitations under the License.
9789

98-
## Agreement on Compatibility from now on
99-
100-
With interfaces now in place since the v16 Upgrade 4 release, GeneXus SA commits to evolve them while maintaining compatibility.
101-

android/pom.xml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616
<dependencies>
1717
<dependency>
1818
<groupId>${project.groupId}</groupId>
19-
<artifactId>gxcommon</artifactId>
19+
<artifactId>gxcryptocommon</artifactId>
2020
<version>${project.version}</version>
2121
<exclusions>
22-
<exclusion> <!-- declare the exclusion here -->
23-
<groupId>org.apache.httpcomponents</groupId>
24-
<artifactId>httpclient</artifactId>
22+
<exclusion> <!-- exclude common io from android -->
23+
<groupId>commons-io</groupId>
24+
<artifactId>commons-io</artifactId>
2525
</exclusion>
26+
<exclusion> <!-- exclude bouncycastle from android -->
27+
<groupId>org.bouncycastle</groupId>
28+
<artifactId>bcprov-jdk18on</artifactId>
29+
</exclusion>
30+
</exclusions>
31+
</dependency>
32+
<dependency>
33+
<groupId>${project.groupId}</groupId>
34+
<artifactId>gxcommon</artifactId>
35+
<version>${project.version}</version>
36+
<exclusions>
2637
<exclusion> <!-- exclude common io from android -->
2738
<groupId>commons-io</groupId>
2839
<artifactId>commons-io</artifactId>
@@ -33,7 +44,7 @@
3344
</exclusion>
3445
</exclusions>
3546
</dependency>
36-
<dependency>
47+
<dependency>
3748
<groupId>org.locationtech.spatial4j</groupId>
3849
<artifactId>spatial4j</artifactId>
3950
<version>0.7</version>

android/src/main/java/com/artech/base/synchronization/bc/PendingEventHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.genexus.GxSilentTrnSdt;
1010
import com.genexus.IGxSilentTrn;
1111

12-
import org.json.JSONArray;
12+
import json.org.json.JSONArray;
1313

1414
public class PendingEventHelper {
1515

android/src/main/java/com/artech/synchronization/ISynchronizationHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import java.util.TreeMap;
44

5-
import org.json.JSONArray;
5+
import json.org.json.JSONArray;
66

77
public interface ISynchronizationHelper {
88

android/src/main/java/com/genexus/GXutil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.genexus.util.GXThreadLocal;
2222
import com.genexus.util.IThreadLocal;
2323

24-
import org.json.JSONObject;
24+
import json.org.json.JSONObject;
2525

2626
public final class GXutil
2727
{
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
package com.genexus.cryptography;
2+
3+
import com.genexus.cryptography.encryption.asymmetric.CipherAsymProvider;
4+
import com.genexus.cryptography.encryption.asymmetric.IGXAsymEncryption;
5+
import com.genexus.cryptography.exception.AlgorithmNotSupportedException;
6+
import com.genexus.cryptography.exception.EncryptionException;
7+
import com.genexus.cryptography.exception.PrivateKeyNotFoundException;
8+
import com.genexus.cryptography.exception.PublicKeyNotFoundException;
9+
10+
public class GXAsymEncryption {
11+
12+
private static final String DEFAULT_SYM_ALGORITHM = "RSA";
13+
private static final String DEFAULT_SYM_PADDING = "PKCS1Padding";
14+
private static final String DEFAULT_SYM_MODE = "ECB";
15+
16+
private static final String SHA256_SYM_PADDING = "OAEPWithSHA-256AndMGF1Padding";
17+
18+
private int _lastError;
19+
private String _lastErrorDescription;
20+
private String _algorithm;
21+
22+
private GXCertificate _cert;
23+
private IGXAsymEncryption _asymAlg;
24+
private boolean _isDirty;
25+
26+
public GXAsymEncryption() {
27+
_isDirty = true;
28+
_algorithm = String.format("%s/%s/%s", DEFAULT_SYM_ALGORITHM,
29+
DEFAULT_SYM_MODE, DEFAULT_SYM_PADDING);
30+
initialize();
31+
}
32+
33+
private void initialize() {
34+
if (_isDirty) {
35+
// Support algorithms = RSA only for now..
36+
// SHA256 ?
37+
setError(0);
38+
39+
if (_cert != null && _cert.certLoaded() == true) {
40+
try {
41+
_asymAlg = new CipherAsymProvider(_algorithm,
42+
_cert.getPublicKey(), _cert.getPrivateKey());
43+
_isDirty = false;
44+
} catch (AlgorithmNotSupportedException e) {
45+
setError(2);
46+
}
47+
} else {
48+
setError(4);
49+
}
50+
}
51+
}
52+
53+
public String encrypt(String text) {
54+
initialize();
55+
String encrypted = "";
56+
if (!anyError()) {
57+
try {
58+
encrypted = _asymAlg.encrypt(text);
59+
} catch (PublicKeyNotFoundException e) {
60+
setError(4);
61+
} catch (EncryptionException e) {
62+
setError(3);
63+
Utils.logError(e);
64+
}
65+
}
66+
return encrypted;
67+
}
68+
69+
public String decrypt(String text) {
70+
initialize();
71+
String decrypted = "";
72+
if (!anyError()) {
73+
74+
try {
75+
decrypted = _asymAlg.decrypt(text);
76+
} catch (PrivateKeyNotFoundException e) {
77+
setError(5);
78+
} catch (EncryptionException e) {
79+
setError(3);
80+
Utils.logError(e);
81+
}
82+
}
83+
return decrypted;
84+
}
85+
86+
private void setError(int errorCode) {
87+
setError(errorCode, "");
88+
}
89+
90+
private void setError(int errorCode, String errDsc) {
91+
_lastError = errorCode;
92+
switch (errorCode) {
93+
case 0:
94+
_lastErrorDescription = Constants.OK;
95+
break;
96+
case 1:
97+
break;
98+
case 2:
99+
_lastErrorDescription = Constants.ALGORITHM_NOT_SUPPORTED;
100+
break;
101+
case 3:
102+
_lastErrorDescription = Constants.ENCRYPTION_ERROR;
103+
break;
104+
case 4:
105+
_lastErrorDescription = "";
106+
break;
107+
case 5:
108+
_lastErrorDescription = Constants.PRIVATEKEY_NOT_PRESENT;
109+
break;
110+
default:
111+
break;
112+
}
113+
if (!errDsc.equals("")) {
114+
_lastErrorDescription = errDsc;
115+
}
116+
}
117+
118+
public String getAlgorithm() {
119+
return _algorithm;
120+
}
121+
122+
public void setAlgorithm(String value)
123+
{
124+
//Android , https://developer.android.com/reference/android/security/keystore/KeyProperties.html#KEY_ALGORITHM_AES
125+
// RSA == RSA
126+
// only support RSA https://developer.android.com/reference/javax/crypto/Cipher.html
127+
// change to Android KeyProperties
128+
//if (value.equalsIgnoreCase("SHA1")) { value = "HmacSHA1"; }
129+
//if (value.equalsIgnoreCase("SHA256")) { value = "HmacSHA256"; }
130+
//if (value.equalsIgnoreCase("SHA512")) { value = "HmacSHA512"; }
131+
132+
// convert sha256 to RSA with sha256
133+
if (value.equalsIgnoreCase("SHA256"))
134+
{
135+
value = String.format("%s/%s/%s", DEFAULT_SYM_ALGORITHM, DEFAULT_SYM_MODE,
136+
SHA256_SYM_PADDING);
137+
}
138+
else
139+
{
140+
value = String.format("%s/%s/%s", value, DEFAULT_SYM_MODE,
141+
DEFAULT_SYM_PADDING);
142+
}
143+
_isDirty = _isDirty || !value.equals(_algorithm);
144+
_algorithm = value;
145+
}
146+
147+
public GXCertificate getCertificate() {
148+
return _cert;
149+
150+
}
151+
152+
public void setCertificate(GXCertificate cert) {
153+
_isDirty = _isDirty || cert != _cert;
154+
_cert = cert;
155+
}
156+
157+
private boolean anyError() {
158+
159+
if (_cert == null || (!_cert.certLoaded() == true)) {
160+
setError(4); // Certificate not initialized
161+
}
162+
return _lastError != 0;
163+
164+
}
165+
166+
public int getErrCode() {
167+
return _lastError;
168+
}
169+
170+
public String getErrDescription() {
171+
return _lastErrorDescription;
172+
}
173+
}

0 commit comments

Comments
 (0)