PKI.js is a pure JavaScript library implementing the formats that are used in PKI applications (signing, encryption, certificate requests, OCSP and TSP requests/responses). It is built on WebCrypto (Web Cryptography API) and requires no plug-ins.
Seems there is some bug in publicKeyInfo.toSchema().toString() because second output is different from first and both publicKeyInfo.toSchema().toString('hex') outputs are identical (and public key after importing in spki mode as above looks fine).
After generating test RSA keypair with...
...printing publicKeyInfo schema gives us:
publicKeyInfo.toSchema().toString():
publicKeyInfo.toSchema().toString('hex'):
Exporting unencrypted priv key from keyPair as above to PKCS#8 PEM gives us:
After importing such privkey from PEM and generating PublicKeyInfo from it with...
...printing publicKeyInfo schema gives us:
publicKeyInfo.toSchema().toString():
publicKeyInfo.toSchema().toString('hex'):
Importing pubkey from such publicKeyInfo works fine with
Seems there is some bug in
publicKeyInfo.toSchema().toString()
because second output is different from first and bothpublicKeyInfo.toSchema().toString('hex')
outputs are identical (and public key after importing in spki mode as above looks fine).