我正在像这样在 Android 上创建 RSA 签名:
Signature signature = Signature.getInstance("SHA512withRSA");
// With what private key?
signature.initSign(privateKey);
// What document to Sign?
signature.update(BYdocument);
// Give me the signed document
byte[] BYsignedDocument = signature.sign();
文档和签名打包在不同的文件中。用户必须手动输入签名。这就是为什么我试图阻止他们输入不是签名的东西。
如何检查签名 BYsignedDocument
是否实际上是不需要公钥或文档的签名?
最佳答案
无法可靠地检测 RSA 签名。如果您有许多 RSA 签名,那么由于使用模数执行计算,您可能会在第一位中看到一些偏差。从这个意义上说,您可以检查某些字节数组是否不是签名,但反之则不然。
有关详细信息,请参阅 this Q/A on cryptography , 特别是 the answer of Poncho
关于java - 如何测试 byte[] 是否为 SHA512withRSA 签名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25703092/