开发者

Signing and sending file in Android

开发者 https://www.devze.com 2023-03-14 18:49 出处:网络
First some background. I have a file, for simplicity\'s sake, let\'s call it test.txt. I want to sign this file and sent it over to the server, which will verify the signature and decrypt it. The ser

First some background.

I have a file, for simplicity's sake, let's call it test.txt. I want to sign this file and sent it over to the server, which will verify the signature and decrypt it. The server has my public key already so there's no need to send that.

So far, I've been able to gene开发者_运维知识库rate a signature for the data I want to send(My code looks exactly like this example: GenSig.java). But the example creates a signature file, which means I have two files I need to send, the sig file and test.txt. My question is, can I do this without creating two separate files? I would ideally like to sent just one file with the data and the signature at the end.


Well, this was a silly question after all. Combining the two files will result in the first file being modified! Therefore the signature data won't match no matter what. The answer is, no, you can't combine them. You are altering the file you are trying to prove hasn't been altered in the course of transit! (Unless I send both in a zip file but I don't want to go down that path). I suppose two files it is!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号