Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ dependencies {
compile "com.google.code.gson:gson:2.2.2"
compile "org.java-websocket:Java-WebSocket:1.4.0"

implementation "com.goterl.lazycode:lazysodium-java:4.2.6"
implementation "net.java.dev.jna:jna:5.5.0"

testCompile "org.mockito:mockito-all:1.8.5"
testCompile "org.powermock:powermock-module-junit4:1.4.11"
testCompile "org.powermock:powermock-api-mockito:1.4.11"
Expand Down
18 changes: 4 additions & 14 deletions src/main/java/com/pusher/client/crypto/nacl/SecretBoxOpener.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ a copy of this software and associated documentation files (the "Software"),

package com.pusher.client.crypto.nacl;

import com.goterl.lazycode.lazysodium.LazySodiumJava;
import com.goterl.lazycode.lazysodium.SodiumJava;
import com.goterl.lazycode.lazysodium.exceptions.SodiumException;
import com.goterl.lazycode.lazysodium.interfaces.Helpers;
import com.goterl.lazycode.lazysodium.interfaces.SecretBox;
import com.goterl.lazycode.lazysodium.utils.Key;

import static com.pusher.client.util.internal.Preconditions.checkArgument;
import static com.pusher.client.util.internal.Preconditions.checkNotNull;
import static java.util.Arrays.fill;
Expand All @@ -52,14 +45,11 @@ public String open(byte[] cypher, byte[] nonce) throws AuthenticityException {
checkNotNull(key, "key has been cleared, create new instance");
checkArgument(nonce.length == 24, "nonce length must be 24 bytes, but is " +
key.length + " bytes");


SecretBox.Lazy secretBoxLazy = (SecretBox.Lazy) Sodium.getInstance();

try {
return secretBoxLazy.cryptoSecretBoxOpenEasy(
Sodium.getInstance().sodiumBin2Hex(cypher), nonce, Key.fromBytes(key));
} catch (SodiumException e) {
TweetNaclFast.SecretBox secretBox = new TweetNaclFast.SecretBox(key);
byte[] result = secretBox.open(cypher, nonce);
return new String(result);
} catch (Exception e) {
throw new AuthenticityException();
}
}
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/com/pusher/client/crypto/nacl/Sodium.java

This file was deleted.

Loading