Thales HSM导入公钥(EO)错误' 04'

发布于 2025-02-05 10:21:42 字数 361 浏览 4 评论 0原文

我正在使用编码的公共RSA密钥发送此命令。

hsm-〜%#b00n00

他的只是标题hsm-,命令eo02表示” der编码ASN.1公共密钥(使用无符号表示形式的整数)”。然后是编码的der本身,然后是键块标头〜%#b00n00。

错误04表示“公钥不符合编码规则”。

这是通过Thales(HSM供应商)获得的示例,唯一的区别是它们使用HSM终端,而我的实现是通过Java通过插座发送消息。

如果有人知道一些东西,请提供帮助。

在建议中,他们告诉我公共密钥是在ASCII中,我必须转换为二进制数据

I am sending this command with a DER encoded public RSA key.

HSM-EO023082018A02820181009B1EA09942164A293536A18E3881A981161BC9147548DBADFA7A3D6F7C0425331427E431A25A1EED0E8BE184AFBE0F1A0CF9F08F731F2148560ED2E9740EDF50CA823BC1A1210A82D71820E6C2DC39B871F7EE170D07CAAAC5CB7E074829B2D0AFB1AF5DE35222EE425CCF3122F5BAA0521FCEF97198102A02CAC7F85FE15785D6731674779E485448FCF934C331C5C6CDA70C31971E09D797EE340528896029AA8434100C0F732FFF7DF5DC7EED975D56E58E30A505D7B9C299B4109EC9D353D3234DA99C3DD4B5030A4F66290BAE13EA0618E11F43BF8B283C1B1A9865E551080E15F60642E15B452626ABBCB8B59E96471CFDD819D14C74C86DF3CD245EBE85D45A3EB19A1CA2CDEF133809A6079ED5C2DFD83F9419897D8064ABE119D4EC7BD01AC9DA0A8E18EADEA9AED624F63FB39DD167C4230C1745FB12A8117B2B9B630206FA7285CA804E28FBB47A013DC17880ACF58B6F3A1ADA6A7A5B3B47CD88C60C3DAB6122C1AB5571C2586BF93FAF96657FCDEDB3F766DB06E804F4FE8C890203010001~%#B00N00

his is just the header HSM-, the command EO and the 02 denoting "DER encoding for ASN.1 Public Key (INTEGER using unsigned representation)". Followed by the encoded DER itself and then the Key block header ~%#B00N00.

Error 04 means "Public key does not conform to encoding rules".

This is a example obtained via Thales ( HSM supplier) and the only diference is they are using hsm terminal, and my implemententation is via Java sending the message via Socket.

If anyone know something please help.

In advice, they inform me is the public Key is in ASCII and i have to convert to binary Data

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开柳相依 2025-02-12 10:21:42

还有其他一些命令的问题。我不得不将不包括公共密钥从ASCII的所有角色转换为十六进制。然后从那里我将它们全部拉在一起,并从十六进制到ASCII进行了转换。因此,您的命令代码EO看起来像这个454F
编码规则02看起来像3032

这种小方法帮助我进行了转换,

public static String hexToAscii(String input) {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < input.length(); i += 2) {
        String str = input.substring(i, i + 2);
        result.append((char) Integer.parseInt(str, 16));
    }
    return result.toString();
}

可能有一种更聪明的方法,但对我有用。

Had the a similar issue with some other commands. I had to convert all characters excluding the public key from ASCII to hex. Then from there I pulled it all together and did a conversion from hex to ASCII. So your command code EO looks like this 454f
Encoding rule 02 looks like 3032

This little method helped me with the conversion

public static String hexToAscii(String input) {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < input.length(); i += 2) {
        String str = input.substring(i, i + 2);
        result.append((char) Integer.parseInt(str, 16));
    }
    return result.toString();
}

There is probably a smarter way of doing this but it worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文