returnvalue of d2i_PKCS7_bio() should be checked, otherwise parsing errors triggers segfault in PEM_write_PKCS7()