Skip to content

Commit

Permalink
Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
norrisjeremy committed Aug 1, 2023
1 parent 0b15aef commit 46ae65b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.75</version>
<version>1.76</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -405,7 +405,7 @@
<Import-Package><![CDATA[
com.sun.jna*;version="${range;[=0,+)}",
org.apache.logging.log4j*;version="${range;[=0,4)}",
org.bouncycastle*;version="[1.69,${versionmask;+})",
org.bouncycastle*;version="[1.76,${versionmask;+})",
org.slf4j*;version="[1.7,${versionmask;+})",
org.ietf.jgss;resolution:=optional,
*
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/jcraft/jsch/bc/CAST128CBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@

import com.jcraft.jsch.Cipher;
import org.bouncycastle.crypto.BufferedBlockCipher;
import org.bouncycastle.crypto.DefaultBufferedBlockCipher;
import org.bouncycastle.crypto.engines.CAST5Engine;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;

public class CAST128CBC implements Cipher {
private static final int ivsize = 8;
Expand Down Expand Up @@ -64,7 +66,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception {
try {
ParametersWithIV keyspec =
new ParametersWithIV(new KeyParameter(key, 0, key.length), iv, 0, iv.length);
cipher = new BufferedBlockCipher(new CBCBlockCipher(new CAST5Engine()));
cipher = new DefaultBufferedBlockCipher(CBCBlockCipher.newInstance(new CAST5Engine()));
cipher.init(mode == ENCRYPT_MODE, keyspec);
} catch (Exception e) {
cipher = null;
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/jcraft/jsch/bc/CAST128CTR.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@

import com.jcraft.jsch.Cipher;
import org.bouncycastle.crypto.engines.CAST5Engine;
import org.bouncycastle.crypto.modes.CTRModeCipher;
import org.bouncycastle.crypto.modes.SICBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;

public class CAST128CTR implements Cipher {
private static final int ivsize = 8;
private static final int bsize = 16;
private SICBlockCipher cipher;
private CTRModeCipher cipher;

@Override
public int getIVSize() {
Expand Down Expand Up @@ -63,7 +65,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception {
try {
ParametersWithIV keyspec =
new ParametersWithIV(new KeyParameter(key, 0, key.length), iv, 0, iv.length);
cipher = new SICBlockCipher(new CAST5Engine());
cipher = SICBlockCipher.newInstance(new CAST5Engine());
cipher.init(mode == ENCRYPT_MODE, keyspec);
} catch (Exception e) {
cipher = null;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/jcraft/jsch/bc/SEEDCBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@

import com.jcraft.jsch.Cipher;
import org.bouncycastle.crypto.BufferedBlockCipher;
import org.bouncycastle.crypto.DefaultBufferedBlockCipher;
import org.bouncycastle.crypto.engines.SEEDEngine;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;

public class SEEDCBC implements Cipher {
private static final int ivsize = 16;
Expand Down Expand Up @@ -64,7 +66,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception {
try {
ParametersWithIV keyspec =
new ParametersWithIV(new KeyParameter(key, 0, key.length), iv, 0, iv.length);
cipher = new BufferedBlockCipher(new CBCBlockCipher(new SEEDEngine()));
cipher = new DefaultBufferedBlockCipher(CBCBlockCipher.newInstance(new SEEDEngine()));
cipher.init(mode == ENCRYPT_MODE, keyspec);
} catch (Exception e) {
cipher = null;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/jcraft/jsch/bc/TwofishCBC.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@

import com.jcraft.jsch.Cipher;
import org.bouncycastle.crypto.BufferedBlockCipher;
import org.bouncycastle.crypto.DefaultBufferedBlockCipher;
import org.bouncycastle.crypto.engines.TwofishEngine;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;

abstract class TwofishCBC implements Cipher {
private static final int ivsize = 16;
Expand Down Expand Up @@ -59,7 +61,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception {
try {
ParametersWithIV keyspec =
new ParametersWithIV(new KeyParameter(key, 0, key.length), iv, 0, iv.length);
cipher = new BufferedBlockCipher(new CBCBlockCipher(new TwofishEngine()));
cipher = new DefaultBufferedBlockCipher(CBCBlockCipher.newInstance(new TwofishEngine()));
cipher.init(mode == ENCRYPT_MODE, keyspec);
} catch (Exception e) {
cipher = null;
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/jcraft/jsch/bc/TwofishCTR.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@

import com.jcraft.jsch.Cipher;
import org.bouncycastle.crypto.engines.TwofishEngine;
import org.bouncycastle.crypto.modes.CTRModeCipher;
import org.bouncycastle.crypto.modes.SICBlockCipher;
import org.bouncycastle.crypto.params.*;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.params.ParametersWithIV;

abstract class TwofishCTR implements Cipher {
private static final int ivsize = 16;
private SICBlockCipher cipher;
private CTRModeCipher cipher;

@Override
public int getIVSize() {
Expand All @@ -58,7 +60,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception {
try {
ParametersWithIV keyspec =
new ParametersWithIV(new KeyParameter(key, 0, key.length), iv, 0, iv.length);
cipher = new SICBlockCipher(new TwofishEngine());
cipher = SICBlockCipher.newInstance(new TwofishEngine());
cipher.init(mode == ENCRYPT_MODE, keyspec);
} catch (Exception e) {
cipher = null;
Expand Down

0 comments on commit 46ae65b

Please sign in to comment.