Fixed try-catch block in getPemFromStream()