The first one is because the PEM file you’re supplying has a PKCS #8 PrivateKeyInfo in it (see also RFC5208) which can contain an RSAPrivateKey, rather than the bare RSAPrivateKey the code expects.
The second one is harder to guess, but I suspect there’s some other -----BEGIN header that’s tripping up the base64 decoder. Based on not printing RSA Private Key Structure, I don’t think ds5 is even making it to any cryptographic calls.


















