mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
java: fix data encryption
fix https://github.com/chrislusf/seaweedfs/issues/3211
This commit is contained in:
parent
0c13fc873c
commit
28f615dcae
|
@ -36,7 +36,7 @@ public class SeaweedCipher {
|
||||||
byte[] encryptedText = AES_cipherInstance.doFinal(clearTextbytes, offset, length);
|
byte[] encryptedText = AES_cipherInstance.doFinal(clearTextbytes, offset, length);
|
||||||
|
|
||||||
byte[] iv = AES_cipherInstance.getIV();
|
byte[] iv = AES_cipherInstance.getIV();
|
||||||
byte[] message = new byte[GCM_NONCE_LENGTH + clearTextbytes.length + GCM_TAG_LENGTH];
|
byte[] message = new byte[GCM_NONCE_LENGTH + length + GCM_TAG_LENGTH];
|
||||||
System.arraycopy(iv, 0, message, 0, GCM_NONCE_LENGTH);
|
System.arraycopy(iv, 0, message, 0, GCM_NONCE_LENGTH);
|
||||||
System.arraycopy(encryptedText, 0, message, GCM_NONCE_LENGTH, encryptedText.length);
|
System.arraycopy(encryptedText, 0, message, GCM_NONCE_LENGTH, encryptedText.length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue