[PATCH v4 16/29] pkcs7: move common functions to PKCS7 helper