Skip to content

Commit 04c8512

Browse files
2026-04-29 Android: Updating to org.bouncycastle:bcprov-jdk18on:1.84 amd latest local java classes
1 parent 0e1d81e commit 04c8512

5 files changed

Lines changed: 35 additions & 27 deletions

File tree

android/CipherPipe/app/src/main/java/eu/cqrxs/cipherpipe/MainActivity.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class MainActivity extends AppCompatActivity {
7373
EncodeEnum encodeType = EncodeEnum.Base64;
7474
ZipType zipType = ZipType.None;
7575

76+
CipherMode2 cmode = CipherMode2.CFB;
77+
7678
static boolean firstTimeInit = true, firstTimeInitEncodings = true;
7779

7880
CipherEnum cipher;
@@ -114,7 +116,7 @@ public void onClick(View v) {
114116
String hashed = keyHash.hash(key);
115117
editKeyHash.setText(hashed);
116118

117-
CipherPipe pipe = new CipherPipe(key, hashed, encodeType, zipType, keyHash);
119+
CipherPipe pipe = new CipherPipe(key, hashed, encodeType, zipType, keyHash, cmode);
118120

119121
CipherEnum[] cipherEnums = pipe.getInPipe();
120122
String pipeSting = "";
@@ -131,7 +133,7 @@ public void onClick(View v) {
131133
String hashed = keyHash.hash(key);
132134
editKeyHash.setText(hashed);
133135

134-
CipherPipe pipe = new CipherPipe(hashed, key, encodeType, zipType, keyHash);
136+
CipherPipe pipe = new CipherPipe(hashed, key, encodeType, zipType, keyHash, cmode);
135137

136138
CipherEnum[] cipherEnums = pipe.getInPipe();
137139
String pipeSting = "";
@@ -144,7 +146,7 @@ public void onClick(View v) {
144146
btnRandText.setOnClickListener(new View.OnClickListener() {
145147
@Override
146148
public void onClick(View v) {
147-
String fortune = eu.cqrxs.cipherpipe.util.Fortune.getFortune();
149+
String fortune = eu.cqrxs.util.Fortune.getFortune();
148150
editTextSource.setText(fortune);
149151
}
150152
});
@@ -174,7 +176,7 @@ public void onClick(View v) {
174176
if (cipherPipeString.length() > 0) {
175177
ciphers = CipherEnum.parsePipeText(cipherPipeString);
176178
}
177-
CipherPipe pipe = new CipherPipe(ciphers, 8, encodeType, zipType, keyHash);
179+
CipherPipe pipe = new CipherPipe(ciphers, 8, encodeType, zipType, keyHash, cmode);
178180
String plain = editTextSource.getText().toString();
179181

180182
String pipeSting = pipe.getPipeString();
@@ -199,7 +201,7 @@ public void onClick(View v) {
199201
if (cipherPipeString.length() > 0) {
200202
ciphers = CipherEnum.parsePipeText(cipherPipeString);
201203
}
202-
CipherPipe pipe = new CipherPipe(ciphers, 8, encodeType, zipType, keyHash);
204+
CipherPipe pipe = new CipherPipe(ciphers, 8, encodeType, zipType, keyHash, cmode);
203205

204206
String encrypted = editTextSource.getText().toString();
205207
CipherEnum[] cipherEnums = pipe.getOutPipe();
@@ -346,7 +348,7 @@ public String encryptString(String plain, String key, String hashed, CipherPipe
346348

347349
String encrypted = "";
348350
try {
349-
encrypted = pipe.encrpytTextGoRounds(plain, key, hashed, encodeType, zipType, keyHash);
351+
encrypted = pipe.encrpytTextGoRounds(plain, key, hashed, encodeType, zipType, keyHash, cmode);
350352
} catch (Exception exi) {
351353
showTextDestination.setText(exi.toString());
352354
}
@@ -357,7 +359,7 @@ public String decryptedString(String encrypted, String key, String hashed, Ciphe
357359

358360
String decrypted = "";
359361
try {
360-
decrypted = pipe.decryptTextRoundsGo(encrypted, key, hashed, encodeType, zipType, keyHash);
362+
decrypted = pipe.decryptTextRoundsGo(encrypted, key, hashed, encodeType, zipType, keyHash, cmode);
361363
} catch (Exception exi) {
362364
showTextDestination.setText(exi.toString());
363365
}

android/CipherPipe/app/src/main/java/eu/cqrxs/crypt/cipher/CipherPipe.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
package eu.cqrxs.crypt.cipher;
1111

12-
import java.awt.*;
13-
import java.awt.image.BufferedImage;
12+
// import java.awt.*;
13+
// import java.awt.image.*;
1414
import java.io.File;
1515
import java.io.IOException;
1616
import java.util.List;
@@ -30,7 +30,9 @@
3030
import org.bouncycastle.crypto.*;
3131

3232
import javax.crypto.Cipher;
33-
import javax.imageio.ImageIO;
33+
import android.graphics.*;
34+
35+
import androidx.annotation.NonNull;
3436

3537
/**
3638
* CipherPipe is symmetric block cipher encryption and decryption pipe line
@@ -91,7 +93,7 @@ public CipherPipe() {
9193
* @param kh {@link KeyHash}
9294
* @param cmode2 {@link CipherMode2}
9395
*/
94-
public CipherPipe(CipherEnum[] cipherEnums,
96+
public CipherPipe(@NonNull CipherEnum[] cipherEnums,
9597
int maxpipe,
9698
EncodeEnum encType,
9799
ZipType zpType,
@@ -859,12 +861,12 @@ public byte[] decodeDecrpytBytes(
859861
}
860862

861863

862-
/**
863-
* drawCipherPipe draws a cipher pipe image for a specified pipe
864-
* state of method: prototype (not fully working)
865-
* @param pipe the specific chipher pipe
866-
* @return {@link BufferedImage}
867-
*/
864+
/*
865+
// * drawCipherPipe draws a cipher pipe image for a specified pipe
866+
// * state of method: prototype (not fully working)
867+
// * @param pipe the specific chipher pipe
868+
// * @return {@link BufferedImage}
869+
//
868870
public static BufferedImage drawCipherPipe(CipherPipe pipe) {
869871
String path = "eu/cqrxs/gui/img/"; // base path of the images
870872
@@ -958,12 +960,12 @@ public static BufferedImage drawCipherPipe(CipherPipe pipe) {
958960
}
959961
960962
961-
/**
962-
* drawDecryptCipherPipe draws a cipher pipe image for a specified pipe
963-
* state of method: prototype (not fully working)
964-
* @param pipe the specific chipher pipe
965-
* @return {@link BufferedImage}
966-
*/
963+
//
964+
// * drawDecryptCipherPipe draws a cipher pipe image for a specified pipe
965+
// * state of method: prototype (not fully working)
966+
// * @param pipe the specific chipher pipe
967+
// * @return {@link BufferedImage}
968+
//
967969
public static BufferedImage drawDecryptCipherPipe(CipherPipe pipe) {
968970
969971
String path = "eu/cqrxs/gui/img/"; // base path of the images
@@ -1043,6 +1045,6 @@ public static BufferedImage drawDecryptCipherPipe(CipherPipe pipe) {
10431045
// ImageIO.write(combined, "PNG", new File(path, "combined.png"));
10441046
return combined;
10451047
}
1046-
1048+
*/
10471049

10481050
}

android/CipherPipe/app/src/main/java/eu/cqrxs/crypt/encoding/UuCoder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
package eu.cqrxs.crypt.encoding;
1111

12+
import org.bouncycastle.util.encoders.Encoder;
13+
1214
import java.io.IOException;
1315
import java.nio.charset.Charset;
1416
import java.nio.charset.StandardCharsets;
@@ -20,7 +22,7 @@
2022
* UuCoder provides UUEncoder and UUDecode
2123
*
2224
*/
23-
public class UuCoder extends java.beans.Encoder implements IEncodable {
25+
public class UuCoder implements IEncodable {
2426

2527
final static byte[] UUEncMap = new byte[] {
2628
0x60, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,

android/CipherPipe/app/src/main/java/eu/cqrxs/crypt/encoding/XxEncoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* 2026-01-21 last functionality that works
2323
*
2424
*/
25-
public class XxEncoder extends java.beans.Encoder implements IEncodable {
25+
public class XxEncoder implements IEncodable {
2626

2727
final static byte[] XXEncMap = new byte[] {
2828
0x2B, 0x2D, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,

android/CipherPipe/app/src/main/java/eu/cqrxs/util/ContextLazy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010

1111
package eu.cqrxs.util;
1212

13-
import javax.naming.InitialContext;
13+
// import javax.naming.InitialContext;
1414

1515
/**
1616
* ContextLazy - provides a lazy singelton for application context
1717
*
1818
*/
1919
public class ContextLazy {
20+
/*
2021
private static ContextLazy instance;
2122
private InitialContext mContext;
2223
@@ -36,4 +37,5 @@ private ContextLazy(InitialContext context) {
3637
mContext = context;
3738
}
3839
40+
*/
3941
}

0 commit comments

Comments
 (0)