[PATCH v6 15/28] pkcs7: move common functions to PKCS7 helper