PyObject *xmlsec_TransformCtxInitialize(PyObject *self, PyObject *args) { PyObject *ctx_obj; xmlSecTransformCtxPtr ctx; if (CheckArgs(args, "O:transformCtxInitialize")) { if(!PyArg_ParseTuple(args, (char *) "O:transformCtxInitialize", &ctx_obj)) return NULL; } else return NULL; ctx = xmlSecTransformCtxPtr_get(ctx_obj); xmlSecTransformCtxInitialize(ctx); Py_INCREF(Py_None); return (Py_None); }
/** * xmlSecEncCtxInitialize: * @encCtx: the pointer to <enc:EncryptedData/> processing context. * @keysMngr: the pointer to keys manager. * * Initializes <enc:EncryptedData/> element processing context. * The caller is responsible for cleaning up returned object by calling * #xmlSecEncCtxFinalize function. * * Returns: 0 on success or a negative value if an error occurs. */ int xmlSecEncCtxInitialize(xmlSecEncCtxPtr encCtx, xmlSecKeysMngrPtr keysMngr) { int ret; xmlSecAssert2(encCtx != NULL, -1); memset(encCtx, 0, sizeof(xmlSecEncCtx)); /* initialize key info */ ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoReadCtx), keysMngr); if(ret < 0) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecKeyInfoCtxInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, XMLSEC_ERRORS_NO_MESSAGE); return(-1); } encCtx->keyInfoReadCtx.mode = xmlSecKeyInfoModeRead; ret = xmlSecKeyInfoCtxInitialize(&(encCtx->keyInfoWriteCtx), keysMngr); if(ret < 0) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecKeyInfoCtxInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, XMLSEC_ERRORS_NO_MESSAGE); return(-1); } encCtx->keyInfoWriteCtx.mode = xmlSecKeyInfoModeWrite; /* it's not wise to write private key :) */ encCtx->keyInfoWriteCtx.keyReq.keyType = xmlSecKeyDataTypePublic; /* initializes transforms encCtx */ ret = xmlSecTransformCtxInitialize(&(encCtx->transformCtx)); if(ret < 0) { xmlSecError(XMLSEC_ERRORS_HERE, NULL, "xmlSecTransformCtxInitialize", XMLSEC_ERRORS_R_XMLSEC_FAILED, XMLSEC_ERRORS_NO_MESSAGE); return(-1); } return(0); }