Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求教sm9加密之后使用asn1_sequence_of_from_der去除了前9或10字节头之后,还是比纯粹的的密文多4字节 #1705

Closed
hanlinbao opened this issue Jun 26, 2024 · 3 comments

Comments

@hanlinbao
Copy link

该怎么把加密结果脱成真正的密文呢?

@hanlinbao
Copy link
Author

发现了里面的c3和c2部分还有asn头,c3部分是0420,c2部分是04xx。
又有新问题了,现在加密结果和全大端序格式的芯片不能互相加解密,只能各自解各自的,而这个芯片可以和其它厂商芯片互通。尝试对硬件密文4字节和8字节还有整个c123端序翻转,还是无法软仿解密它

@emmansun
Copy link

BER/DER不都是TLV结构吗?你要解析ASN1密文应该调用本库的sm9_ciphertext_from_der方法吧。

@hanlinbao
Copy link
Author

BER/DER不都是TLV结构吗?你要解析ASN1密文应该调用本库的sm9_ciphertext_from_der方法吧。

十分感谢,才发现我应该用sm9_do_encrypt就没有asn头了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants