Close ByteArrayOutputStream / Use CertificateException and KeyException for reading certificates and private keys