如何检查上传的文件是否带有签名

huangapple go评论81阅读模式
英文:

How to Check if the uploaded file has signature

问题

如何检查通过输入字段上传的文件是否具有签名?在将其转换为Base64后,验证是否包含任何签名的过程是什么?

英文:

How can I check if a file uploaded through an input field has a signature? After converting it to Base64, what is the process to verify if it contains any signature?

答案1

得分: 1

After conversion of anything (PDF or not) to base 64 you will require at least 6 times the effort. So to detect one single word here are some of its fingerprints.

  • L1NpZ
  • IC9TaWc
  • ZS9TaWcK
  • cGUvU2ln

and you can see a pattern but how could you tell this is a match too.

  • U0lHTkFUVVJF

Thus the only reliable method is permutate manifold the endless possibilities or reverse to Plain Text.

The secondary issue is that a PDF signature could be encoded or encrypted or both or neither or perhaps compressed, so the permutations become ad infinitum.

So you need to use a plain text string as a signature and then its only one of three to detect. This file was signed and is now not signed but still has the fingerprint of a signature.

如何检查上传的文件是否带有签名

Answer

From a programmers perspective

So if it is 3 times or more (x9 x27 x87) to do a quick test then it will be faster to compress the base64 back to binary and do a single test there.

And for that there are several answers but this one is not a recommendation for any.

I would simply filter 1st based on "/Sig" then try to verify that signature.

英文:

After conversion of anything (PDF or not) to base 64 you will require at least 6 times the effort. So to detect one single word here are some of its fingerprints.

  • L1NpZ
  • IC9TaWc
  • ZS9TaWcK
  • cGUvU2ln

and you can see a pattern but how could you tell this is a match too.

  • U0lHTkFUVVJF

Thus the only reliable method is permutate manifold the endless possibilities or reverse to Plain Text.

The secondary issue is that a PDF signature could be encoded or encrypted or both or neither or perhaps compressed, so the permutations become ad infinitum.

So you need to use a plain text string as a signature and then its only one of three to detect. This file was signed and is now not signed but still has the fingerprint of a signature.

如何检查上传的文件是否带有签名

Answer

From a programmers perspective

So if it is 3 times or more (x9 x27 x87) to do a quick test then it will be faster to compress the base64 back to binary and do a single test there.

And for that there are several answers but this one is not a recommendation for any.

I would simply filter 1st based on "/Sig" then try to verify that signature.

huangapple
  • 本文由 发表于 2023年7月27日 19:19:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76779221.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定