NativeCrypto: adjust thrown exceptions

Should be throwing CertificateException when InputStream is null.

Sometimes OpenSSL doesn't push an error onto the list when PEM encoding
fails. This can be seen with the call to PEM_read_bio_X509 with
hyts_badpem.cer  Throw a generic RuntimeException instead.

(cherry picked from commit d14eedd3c70f67a0d7af71b56dcf7b8e4f030bdd)

Bug: 8488314
Change-Id: I716c089c00ab477b4803bdd774681e52384eb95d
3 files changed