Skip to content

Commit

Permalink
Fixed a NoSuchMethodError
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Dec 31, 2020
1 parent d6c2507 commit 9fbf704
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.security.Key;
import java.security.SecureRandom;
Expand Down Expand Up @@ -99,13 +100,15 @@ public byte[] decrypt(byte[] cipherTextWithIv) throws Exception {
}

ivLength = buffer.position() - mark - 1; // don't include the splitter itself
buffer.position(mark); // reset to the pre-while index
// don't remove this cast, it'll cause problems if you remove it
((Buffer) buffer).position(mark); // reset to the pre-while index
}

byte[] iv = new byte[ivLength];
buffer.get(iv);

buffer.position(buffer.position() + 1); // skip splitter
// don't remove this cast, it'll cause problems if you remove it
((Buffer) buffer).position(buffer.position() + 1); // skip splitter

byte[] cipherText = new byte[buffer.remaining()];
buffer.get(cipherText);
Expand Down

0 comments on commit 9fbf704

Please sign in to comment.