如何在 Android 上使用 SpongyCastle 创建 pkcs#7 证书?
我正在尝试在我的 Android 应用程序上生成 pkcs7 文件以在客户端和服务器之间进行通信(机密数据在它们之间传输)。
我实际上尝试了 SpongyCastle,它看起来很适合这项工作。
实际上,我尝试了给出的示例:AttrCertExample。我的证书似乎是最后生成的(v3 证书)并经过验证,一切正常。
然后我尝试像这样制作它的der版本:
String strResult = Base64.encode(cert.getTBSCertificate(), Base64.NO_WRAP).toString();
但是这个操作的结果给了我一个非常小的Base 64编码字符串(我想要这样的东西:
MIICyzCCAbOgAwI [...] 6Shws=(960个字符base 64)
您真的知道如何获取 SpongyCastle 生成的 PKCS#7 版本的证书吗?
非常感谢您的帮助。如果需要,请提供更多代码。
I am trying to generate on my Android app pkcs7 file to communicate between client and server (confidential data are transmitted between them).
I actually try SpongyCastle which seems fine for the job.
Actually, I tried with the example given : AttrCertExample. My certificate seems generated by the end (a v3 one) and verified, all is OK.
Then I try to make a der version of it like this :
String strResult = Base64.encode(cert.getTBSCertificate(), Base64.NO_WRAP).toString();
But the result of this operation gives me a very little Base 64 encoded String (where I wanted to have something like this :
MIICyzCCAbOgAwI [ ... ] 6Shws= (960 chars in base 64)
Do you actually know how to get a PKCS#7 version of the certificate generated by SpongyCastle ?
Thanks a lot in advance, I appreciate the help. I can give some more code if needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很快就得到了答案。这样做的方法如下:
然后您获得如下证书:
通过使用 DER 扩展名保存此证书,您将能够轻松查看证书内容。
I got the answer quickly. This is how you do this :
Then you obtain a certificate like this :
By saving this with DER extension, you will be able to see certificate contents easily.