Esempio n. 1
0
/**
 * xmlSecEncCtxReset:
 * @encCtx:             the pointer to <enc:EncryptedData/> processing context.
 *
 * Resets @encCtx object, user settings are not touched.
 */
void
xmlSecEncCtxReset(xmlSecEncCtxPtr encCtx) {
    xmlSecAssert(encCtx != NULL);

    xmlSecTransformCtxReset(&(encCtx->transformCtx));
    xmlSecKeyInfoCtxReset(&(encCtx->keyInfoReadCtx));
    xmlSecKeyInfoCtxReset(&(encCtx->keyInfoWriteCtx));

    encCtx->operation           = xmlSecTransformOperationNone;
    encCtx->result              = NULL;
    encCtx->resultBase64Encoded = 0;
    encCtx->resultReplaced      = 0;
    encCtx->encMethod           = NULL;

    if (encCtx->replacedNodeList != NULL) {
        xmlFreeNodeList(encCtx->replacedNodeList);
        encCtx->replacedNodeList = NULL;
    }

    if(encCtx->encKey != NULL) {
        xmlSecKeyDestroy(encCtx->encKey);
        encCtx->encKey = NULL;
    }

    if(encCtx->id != NULL) {
        xmlFree(encCtx->id);
        encCtx->id = NULL;
    }

    if(encCtx->type != NULL) {
        xmlFree(encCtx->type);
        encCtx->type = NULL;
    }

    if(encCtx->mimeType != NULL) {
        xmlFree(encCtx->mimeType);
        encCtx->mimeType = NULL;
    }

    if(encCtx->encoding != NULL) {
        xmlFree(encCtx->encoding);
        encCtx->encoding = NULL;
    }

    if(encCtx->recipient != NULL) {
        xmlFree(encCtx->recipient);
        encCtx->recipient = NULL;
    }

    if(encCtx->carriedKeyName != NULL) {
        xmlFree(encCtx->carriedKeyName);
        encCtx->carriedKeyName = NULL;
    }

    encCtx->encDataNode = encCtx->encMethodNode =
                              encCtx->keyInfoNode = encCtx->cipherValueNode = NULL;
}
Esempio n. 2
0
PyObject *xmlsec_TransformCtxReset(PyObject *self, PyObject *args) {
  PyObject *ctx_obj;
  xmlSecTransformCtxPtr ctx;

  if (CheckArgs(args, "O:transformCtxReset")) {
    if(!PyArg_ParseTuple(args, (char *) "O:transformCtxReset", &ctx_obj))
      return NULL;
  }
  else return NULL;

  ctx = xmlSecTransformCtxPtr_get(ctx_obj);
  xmlSecTransformCtxReset(ctx);

  Py_INCREF(Py_None);
  return (Py_None);
}