diff --git a/build.gradle b/build.gradle index ca47f99..b174a86 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,7 @@ dependencies { exclude group: 'org.hamcrest', module: 'hamcrest-core' exclude group: 'junit', module: 'junit' } - implementation ('org.bouncycastle:bcprov-jdk15on:1.64') { + implementation ('org.bouncycastle:bcprov-jdk18on:1.77') { exclude group: 'org.hamcrest', module: 'hamcrest-core' } implementation ('de.mkammerer:argon2-jvm:2.11') { @@ -40,16 +40,13 @@ dependencies { exclude group: 'net.java.dev.jna', module: 'jna' } implementation ('net.java.dev.jna:jna:5.8.0') - implementation ('ch.qos.logback:logback-classic:1.2.8') { + implementation ('ch.qos.logback:logback-classic:1.4.14') { exclude group: 'org.hamcrest', module: 'hamcrest-core' exclude group: 'org.slf4j' } - implementation ('org.slf4j:slf4j-api:1.7.30') - testImplementation ('junit:junit:4.12') { - exclude group: 'org.hamcrest', module: 'hamcrest-core' - } - testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '2.2' - testImplementation 'junit:junit:4.13.1' + implementation ('org.slf4j:slf4j-api:2.0.12') + testImplementation('org.junit.jupiter:junit-jupiter-api:5.10.0') + testImplementation('org.junit.vintage:junit-vintage-engine:5.10.0') } processResources { @@ -61,25 +58,10 @@ processResources { } extraJavaModuleInfo { - module('logback-core-1.2.8.jar', 'logback.core', '1.2.8') { - exports('ch.qos.logback.core') - exports('ch.qos.logback.core.spi') - requires('java.xml') - } - module('logback-classic-1.2.8.jar', 'logback.classic', '1.2.8') { - exports('ch.qos.logback.classic') - exports('ch.qos.logback.classic.spi') - requires('org.slf4j') - requires('logback.core') - requires('java.xml') - requires('java.logging') - } module('json-simple-1.1.1.jar', 'json.simple', '1.1.1') { exports('org.json.simple') exports('org.json.simple.parser') } module('jnacl-1.0.0.jar', 'eu.neilalexander.jnacl', '1.0.0') - module('junit-4.12.jar', 'junit', '4.12') { - exports('org.junit') - } + module('hamcrest-core-1.3.jar', 'org.hamcrest.core', '1.3') } diff --git a/src/main/java/com/sparrowwallet/drongo/crypto/AESKeyCrypter.java b/src/main/java/com/sparrowwallet/drongo/crypto/AESKeyCrypter.java index 48d2a5a..35b4baa 100644 --- a/src/main/java/com/sparrowwallet/drongo/crypto/AESKeyCrypter.java +++ b/src/main/java/com/sparrowwallet/drongo/crypto/AESKeyCrypter.java @@ -41,7 +41,7 @@ public class AESKeyCrypter implements KeyCrypter { ParametersWithIV keyWithIv = new ParametersWithIV(new KeyParameter(aesKey.getKeyBytes()), dataToDecrypt.getInitialisationVector()); // Decrypt the message. - BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine())); + BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(CBCBlockCipher.newInstance(AESEngine.newInstance())); cipher.init(false, keyWithIv); byte[] cipherBytes = dataToDecrypt.getEncryptedBytes(); @@ -79,7 +79,7 @@ public class AESKeyCrypter implements KeyCrypter { ParametersWithIV keyWithIv = new ParametersWithIV(new KeyParameter(aesKey.getKeyBytes()), iv); // Encrypt using AES. - BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine())); + BufferedBlockCipher cipher = new PaddedBufferedBlockCipher(CBCBlockCipher.newInstance(AESEngine.newInstance())); cipher.init(true, keyWithIv); byte[] encryptedBytes = new byte[cipher.getOutputSize(plainBytes.length)]; final int length1 = cipher.processBytes(plainBytes, 0, plainBytes.length, encryptedBytes, 0); diff --git a/src/main/java/com/sparrowwallet/drongo/crypto/ECKey.java b/src/main/java/com/sparrowwallet/drongo/crypto/ECKey.java index bcf6c0b..676e193 100644 --- a/src/main/java/com/sparrowwallet/drongo/crypto/ECKey.java +++ b/src/main/java/com/sparrowwallet/drongo/crypto/ECKey.java @@ -552,7 +552,7 @@ public class ECKey { throw new IllegalArgumentException("Input has 'publicKey' with bad tag number"); } - byte[] pubbits = ((DERBitString)pubkey.getObject()).getBytes(); + byte[] pubbits = ((DERBitString)pubkey.getBaseObject()).getBytes(); if(pubbits.length != 33 && pubbits.length != 65) { throw new IllegalArgumentException("Input has 'publicKey' with invalid length"); }; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 5ce479c..9c6dfe9 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -2,8 +2,8 @@ open module com.sparrowwallet.drongo { requires org.bouncycastle.provider; requires de.mkammerer.argon2.nolibs; requires org.slf4j; - requires logback.core; - requires logback.classic; + requires ch.qos.logback.core; + requires ch.qos.logback.classic; requires json.simple; exports com.sparrowwallet.drongo; exports com.sparrowwallet.drongo.psbt;