Open ribizli opened 3 years ago
-----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- are 27 + 25 = 52 characters.
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
27 + 25 = 52
But the code truncates 57 characters:
function rsa_import_pem_private_pkcs8(key: string): RSAKeyParams { const trimmedKey = key.substr(27, key.length - 57); }
So I get the error InvalidCharacterError: The string to be decoded is not correctly encoded from atob.
atob
My workaround is to add 5 more - at the end of the file. -----END PRIVATE KEY----------.
-
-----END PRIVATE KEY----------
-----BEGIN PRIVATE KEY-----
and-----END PRIVATE KEY-----
are27 + 25 = 52
characters.But the code truncates 57 characters:
So I get the error InvalidCharacterError: The string to be decoded is not correctly encoded from
atob
.My workaround is to add 5 more
-
at the end of the file.-----END PRIVATE KEY----------
.