You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think a better way to determine whether it's a PEM or DER is by reading the first line. For example, if it starts with -----BEGIN RSA PRIVATE KEY----- it's a PEM formatted RSA private key. Probably you can use the regex -----[A-Z ]+----- to catch other types of keys too.
The other option, and probably more future proof is to attempt to parse it as a PEM first, and if that fails, parse as a DER file. If both fail, then it's invalid.
Unfortunately I don't have much time at the moment to work on this, but I'd be happy to review and PRs
Seems strange to me - why treat the secret format differently for different algorithms? Aren't they orthogonal concerns?
The text was updated successfully, but these errors were encountered: