Skip to content

Commit 71be683

Browse files
Fixes for Nokia
1 parent 8883be5 commit 71be683

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,7 @@ If you want to use ModernConnector for ports 80/443/8080, your app WILL need a c
7474
It simply does not exist. This library currently takes care of encryption but will not verify the remote server. It cannot be considered secure for that reason, but it can let you connect to secure services.
7575

7676
### Building
77-
Use netbeans 8.2 with Mobility and the proper j2me sdk setup. If that sounds awful its because it is. I should fix this eventually.
77+
Use netbeans 8.2 with Mobility and the proper j2me sdk setup. If that sounds awful its because it is. I should fix this eventually.
78+
79+
### Source of the Magic Jar's
80+
THe magicalbouncycastle that works is directly from a binary distribution built by BouncyCastle themselves, though I forgot what exact download link it was. As for the bytecode modified version needed for nokia's due to a bug relating to virtualinvoke is provided by https://github.com/shinovon/
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#Sun, 12 Oct 2025 00:00:17 -0400
1+
#Tue, 21 Oct 2025 20:55:43 -0400
22
app-version.autoincrement=true
33
config.active=
4-
deployment.counter=70
5-
deployment.number=0.0.69
4+
deployment.counter=81
5+
deployment.number=0.0.80
66
javadoc.preview=true
77
netbeans.user=C\:\\Users\\NealShah\\AppData\\Roaming\\NetBeans\\8.2
88
platform.apis.defaults=J2ME-WS-1.0,MMAPI-1.2,OMDA_AP-1.0,JSR82-1.1,Logging-1.0,JSR211-1.0,SATSA-1.0,JSR234-1.0,AMS-1.0,JSR280-1.0,JSR75-1.0,JSR226-1.0,DEVICE_ACCESS-1.0,JSR256-1.2,JSR184-1.1,JSR239-1.0,WMA-2.0,WMA-1.1,JSR257-1.0,JSR179-1.0

nbproject/project.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ dist.jar=MobileApplication1.jar
2323
dist.javadoc.dir=${dist.dir}/doc
2424
dist.root.dir=dist
2525
extra.classpath=
26+
file.reference.byteCodeModifiedBouncyCastle.jar=byteCodeModifiedBouncyCastle.jar
2627
file.reference.keystore.ks=../../../keystore.ks
27-
file.reference.magicalbouncycastlethatworks.jar=magicalbouncycastlethatworks.jar
2828
filter.exclude.tests=false
2929
filter.excludes=
3030
filter.more.excludes=**/overview.html,**/package.html
@@ -46,7 +46,7 @@ javadoc.splitindex=true
4646
javadoc.use=true
4747
javadoc.version=false
4848
javadoc.windowtitle=
49-
libs.classpath=${file.reference.magicalbouncycastlethatworks.jar}
49+
libs.classpath=${file.reference.byteCodeModifiedBouncyCastle.jar}
5050
main.class=
5151
main.class.class=applet
5252
manifest.apipermissions=MIDlet-Permissions: javax.microedition.io.Connector.socket\n
@@ -55,13 +55,13 @@ manifest.is.liblet=false
5555
manifest.jad=
5656
manifest.manifest=
5757
manifest.midlets=MIDlet-1: Midlet, ,tech.alicesworld.ModernConnector.Midlet\n
58-
manifest.others=MIDlet-Vendor: Vendor\nMIDlet-Version: 1.0\nMIDlet-Name: MobileApplication1\n
58+
manifest.others=MIDlet-Vendor: Vendor\nMIDlet-Version: 1.0\nMicroEdition-Configuration: CLDC-1.1\nMIDlet-Name: MobileApplication1\n
5959
manifest.pushregistry=
6060
name=MobileApplication1
6161
no.dependencies=false
6262
nokiaS80.application.icon=
6363
obfuscated.classes.dir=${build.dir}/obfuscated
64-
obfuscation.custom=\ -keep public class tech.alicesworld.ModernConnector.** {\n public *;\n private *;\n }\n\n -keep public class org.bouncycastle.** {\n public *;\n private *;\n }\n
64+
obfuscation.custom=\ -keep public class tech.alicesworld.ModernConnector.** {\n public *;\n private *;\n }
6565
obfuscation.level=9
6666
obfuscator.destjar=${build.dir}/obfuscated.jar
6767
obfuscator.srcjar=${build.dir}/before-obfuscation.jar

src/tech/alicesworld/ModernConnector/CustomTlsClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.Vector;
1111
import org.bouncycastle.crypto.tls.Certificate;
1212
import org.bouncycastle.crypto.tls.CertificateRequest;
13+
import org.bouncycastle.crypto.tls.CipherSuite;
1314
import org.bouncycastle.crypto.tls.DefaultTlsClient;
1415
import org.bouncycastle.crypto.tls.NameType;
1516
import org.bouncycastle.crypto.tls.ServerName;
@@ -33,6 +34,13 @@ public CustomTlsClient() {
3334
this("cloudflare.com");
3435
}
3536

37+
// // Nokia JVM fix-- Wont pull from above class for some reason?
38+
// public int[] getCipherSuites() {
39+
// System.out.println("Inlined Cipher");
40+
// return new int[] { 49195, 49187, 49161, 49199, 49191, 49171, 162, 64, 50, 158, 103, 51, 156, 60, 47 };
41+
// }
42+
43+
3644
public Hashtable getClientExtensions() throws IOException {
3745
Hashtable ext = TlsExtensionsUtils.ensureExtensionsInitialised(super.getClientExtensions());
3846
Vector serverNames = new Vector();

src/tech/alicesworld/ModernConnector/LegacyServerName.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ public void encode(OutputStream output) throws IOException
3030
switch (nameType)
3131
{
3232
case NameType.host_name:
33-
byte[] asciiEncoding = ((String)name).getBytes("US_ASCII"); // Real bouncy castle uses ASCII here which breaks some devices
33+
34+
byte[] asciiEncoding;
35+
try{
36+
// Real bouncy castle uses ASCII here which breaks some devices
37+
asciiEncoding = ((String)name).getBytes("US_ASCII");
38+
} catch(Exception e) {
39+
asciiEncoding = ((String)name).getBytes("ASCII");
40+
}
41+
3442
if (asciiEncoding.length < 1)
3543
{
3644
throw new TlsFatalAlert(AlertDescription.internal_error);

src/tech/alicesworld/ModernConnector/ModernConnector.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public static Object open(String connectionURL) throws IOException {
7474
} catch (Exception e) {
7575
// Nothing
7676
}
77-
System.out.println("Using port " + port + " There was no " + endpointData[1]);
7877
SecureConnection socket = (SecureConnection) ModernConnector.open("tls://" + host + ":" + port);
7978
return new ModernHTTPSConnection(socket, connectionURL);
8079
}

0 commit comments

Comments
 (0)