[PATCH v8 14/27] pkcs7: move common functions to PKCS7 helper