Skip to content

Commit 4be5228

Browse files
authored
Ensure reset of security provider preference. (#1013)
1 parent 1398b19 commit 4be5228

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/main/java/net/schmizz/sshj/common/SecurityUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ public static synchronized void setRegisterBouncyCastle(boolean registerBouncyCa
276276
*/
277277
public static synchronized void setSecurityProvider(String securityProvider) {
278278
SecurityUtils.securityProvider = securityProvider;
279+
if(null == securityProvider) {
280+
SecurityUtils.registerBouncyCastle = null;
281+
}
279282
registrationDone = false;
280283
}
281284

src/test/java/net/schmizz/sshj/transport/kex/Curve25519DHTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import net.schmizz.sshj.common.SecurityUtils;
1919
import net.schmizz.sshj.transport.random.JCERandom;
20+
import org.junit.jupiter.api.AfterEach;
2021
import org.junit.jupiter.api.BeforeEach;
2122
import org.junit.jupiter.api.Test;
2223

@@ -43,6 +44,7 @@ public class Curve25519DHTest {
4344
};
4445

4546
@BeforeEach
47+
@AfterEach
4648
public void clearSecurityProvider() {
4749
SecurityUtils.setSecurityProvider(null);
4850
}

0 commit comments

Comments
 (0)