I am working on a project that will depend on the exchange of public keys from client to server and my back end is written in java. It seems like there may be a bug in this js library. If the bug is in the js library I would point it to the shared library you are using as the same example will not work for these guys either https://kjur.github.io/jsrsasign/
Seems like a deeper problem needs to be identified. When I debugged it in chrome I noticed an issue parsing the private key, as this condition is not met by the private key: "if (asn1.sub.length === 9) {"
The following example does not work.... I am generating my keys in Java as per this example http://www.txedo.me/blog/java-generate-rsa-keys-write-pem-file/ or even with my own implementation in Java.
I am working on a project that will depend on the exchange of public keys from client to server and my back end is written in java. It seems like there may be a bug in this js library. If the bug is in the js library I would point it to the shared library you are using as the same example will not work for these guys either https://kjur.github.io/jsrsasign/
Seems like a deeper problem needs to be identified. When I debugged it in chrome I noticed an issue parsing the private key, as this condition is not met by the private key: "if (asn1.sub.length === 9) {"
Please see the RSAKey.prototype.parseKey method.
-----BEGIN RSA PRIVATE KEY----- MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJLORhDfV6VwpZCF 0ZgCKc7cP3Sy5EFkkHY1LKDNqhYmU+ey7GzNjJbm/JIZQwtufcpP8K14kEq2rHo/ F2hN5DQ0hRpSAXljxuz0Y0l5DeELQYrYjcjFMOU5071ebBNuCxm7x3hqSXt/LlmW GBo73rf3cksI5sxlKEvr69fl4vUJAgMBAAECgYBViTxHzmn56hV9jIrff7suXSPX 8feOpnKJfVgAZXSJrVFL+fNJPcaBkhptYayvt3QxcbxwxoOEFMWQALy5uFCSuWk8 WOiUVlVoCZUjW1fn6z3N0WiuW0yJH315yYjHunFI9THaToIT8XXANZPMS6Jw84Qy EmNKF6DgirYKvmEyAQJBAORadaff+2yh9r8r25SIIujQpogYMB+JbyAtfSwHMPIC ZWC137ah1hYj82KutL0yQ9r/6iM+/lY9a5W6SvpWpkECQQCklFfjFxlQ13VrkrGp h8duqbWm0BdX32lqaTNPscDaz60GWw7LPNhb0LY2mlTP1iSgWdt3VCWKvowHA1Qh 92zJAkANxEJZl5BB0VXd2pgHUVnBbWrMw6CLF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