The PemPrivateKeyParser uses a brute-force approach to find a suitable algorithm to parse a PEM-encoded key. This could be improved by using the DerElement class to read the ASN.1 and find out what type of key this is. This works for all PKCS#8 keys.
Comment From: philwebb
Closing in favor of PR #39162. Thanks @Wzy19930507