InvalidKeyException for "opaque" keys null getEncoded()

This makes OpenSSL-backed KeyFactory instances (RSA, DSA, EC)
translateKey method throw InvalidKeyException for "opaque" keys whose
getFormat() returns non-null while getEncoded() returns null.
Prior to this change a NullPointerException was thrown.

Change-Id: Ie0f3ec27356307338839f4c2b248b0e79578e19b
3 files changed