Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Upload Can Not View File #3211

Closed
jiangjie5 opened this issue Jun 21, 2022 · 3 comments
Closed

Test Upload Can Not View File #3211

jiangjie5 opened this issue Jun 21, 2022 · 3 comments

Comments

@jiangjie5
Copy link

jiangjie5 commented Jun 21, 2022

Use the following,Upload files using java,cant not view file

nohup ./weed master -mdir=/data/seaweedfs/master -port=9333 -ip=10.166.210.13 -port.grpc=19333 >> /data/seaweedfs/master/master.log &
nohup ./weed volume -dir=/data/seaweedfs/volume -max=7 -mserver="10.166.210.13:9333" -ip=10.166.210.13 -port=9080 -port.grpc=19080 >> /data/seaweedfs/volume/volume.log &
nohup ./weed filer -port=8889 -encryptVolumeData -master=10.166.210.13:9333 -ip=10.166.210.13 >> /data/seaweedfs/filer/filer.log &

error is // check entire authentication tag for time-consistency
int mismatch = 0;
for (int i = 0; i < tagLenBytes; i++) {
mismatch |= tag[i] ^ sOut[i];
}

       if (mismatch != 0) {
           throw new AEADBadTagException("Tag mismatch!");
      }

Thanks

@chrislusf
Copy link
Collaborator

Please have some reusable code to reproduce the problem.

@jiangjie5
Copy link
Author

I use Test Class
@test
public void testUpload() throws IOException {
FilerClient client = new FilerClient("10.166.210.13", 18889);
SeaweedOutputStream seaweedOutputStream = new SeaweedOutputStream(client, "/images/testa/testb/test.jpg");
Files.copy(new File("C:\saf\a.jpg"), seaweedOutputStream);
seaweedOutputStream.close();
}

@test
public void testDownload() throws IOException {
FilerClient client = new FilerClient("10.166.210.13", 18889);
SeaweedInputStream seaweedInputStream = new SeaweedInputStream(client, "/images/testa/testb/test.jpg");
IOUtils.copy(seaweedInputStream, new FileOutputStream("C:\saf\test2.jpg"));
seaweedInputStream.close();
}

when I download file after upload file, error is
java.io.IOException: fail to decrypt

at seaweedfs.client.SeaweedRead.doFetchOneFullChunkData(SeaweedRead.java:187)
at seaweedfs.client.SeaweedRead.doFetchFullChunkData(SeaweedRead.java:122)
at seaweedfs.client.SeaweedRead.readChunkView(SeaweedRead.java:102)
at seaweedfs.client.SeaweedRead.read(SeaweedRead.java:75)
at seaweedfs.client.SeaweedInputStream.read(SeaweedInputStream.java:126)
at seaweedfs.client.SeaweedInputStream.read(SeaweedInputStream.java:106)
at java.io.InputStream.read(InputStream.java:101)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1792)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1769)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1744)
at com.kpmg.kcc.FileUploadTest.testDownload(FileUploadTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

Caused by: javax.crypto.AEADBadTagException: Tag mismatch!
at com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:578)
at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1116)
at com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1053)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:853)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2222)
at seaweedfs.client.SeaweedCipher.decrypt(SeaweedCipher.java:51)
at seaweedfs.client.SeaweedRead.doFetchOneFullChunkData(SeaweedRead.java:185)

But I use seaweedfs UI upload file, download file,decrypt is success

@waywtdcc
Copy link

Is this resolved? @chrislusf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants