如何在android运行时访问库jar文件?
我创建了一个加密模块并将其导出为 jar 文件。
该库在加载时需要进行自我完整性测试才能通过 FIPS 验证。
这样做的第一个想法是在运行时读取 jar 文件,生成哈希值并将其与保存在某处的签名进行比较。
通过解压使用 jar 文件的应用程序 apk,我没有找到该 jar。所以我猜jar中的类保存在classes.dex中,对吗?是否可以从classes.dex恢复jar?
I have create a cryptographic module and export it as jar file.
The library need self integrity testing when loaded in order to pass the FIPS validation.
The first idea comes up to do so is to read the jar file at run time, make a hash and compare it to a signature saved somewhere.
By unzip the application apk which using the jar file, I do not find the jar. So I guess the classes in jar are saved in classes.dex, am I right? Is it possible to recover the jar from classes.dex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在加载模块之前,您需要执行“批准的完整性技术”。唯一获得 NIST“批准”的完整性验证方法是:
- DSA/RSA/ECDSA签名
- C/MAC 或 HMAC
请参阅 FIPS140-2 实施指南文件。
简单的 MD5/SHA-1/SHA-2 哈希值是不够的。
You need to do an "Approved integrity technique" before you load your module. The only NIST "Approved" integrity verification methods are:
- DSA/RSA/ECDSA signature
- C/MAC or HMAC
See "6.4 Approved Integrity Techniques" in FIPS140-2 Implementation Guidance document.
A simple MD5/SHA-1/SHA-2 hash is not sufficient.
不,
而且,这对你没有一点好处。无论谁更改了您的 JAR,也只会更改哈希值。
No.
Moreover, it would not do you a bit of good. Whoever changes your JAR would merely change the hash as well.
dex 格式不是公开的,但确实存在一个工具可以将其提取到 jar,它称为 dex2jar,可以在此处找到 http://code.google.com/p/dex2jar/
但并不认为它解决了您的问题,只是认为您想知道。
The dex format isn't public, but there do exist a tool to extract it to a jar, its called dex2jar and can be found here http://code.google.com/p/dex2jar/
Don't think it solves your problem though, just thought you wanted to know.