Exemple #1
0
PyObject *xmlSecDSigCtx_setattr(PyObject *self, PyObject *args) {
  PyObject *dsigCtx_obj, *value_obj;
  xmlSecDSigCtxPtr dsigCtx;
  const char *name;

  if (CheckArgs(args, "OS?:dsigCtxSetAttr")) {
    if (!PyArg_ParseTuple(args, "OsO:dsigCtxSetAttr",
			  &dsigCtx_obj, &name, &value_obj))
      return NULL;
  }
  else return NULL;

  dsigCtx = xmlSecDSigCtxPtr_get(dsigCtx_obj);
    
  if (!strcmp(name, "flags"))
    dsigCtx->flags = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "flags2"))
    dsigCtx->flags2 = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "keyInfoReadCtx"))
    dsigCtx->keyInfoReadCtx = *(xmlSecKeyInfoCtxPtr_get(value_obj));
  else if (!strcmp(name, "keyInfoWriteCtx"))
    dsigCtx->keyInfoWriteCtx = *(xmlSecKeyInfoCtxPtr_get(value_obj));
  else if (!strcmp(name, "transformCtx"))
    dsigCtx->transformCtx = *(xmlSecTransformCtxPtr_get(value_obj));
  else if (!strcmp(name, "enabledReferenceUris"))
    dsigCtx->enabledReferenceUris = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "enabledReferenceTransforms"))
    dsigCtx->enabledReferenceTransforms = xmlSecPtrListPtr_get(value_obj);
  else if (!strcmp(name, "defSignMethodId"))
    dsigCtx->defSignMethodId = xmlSecTransformId_get(value_obj);
  else if (!strcmp(name, "defC14NMethodId"))
    dsigCtx->defC14NMethodId = xmlSecTransformId_get(value_obj);
  else if (!strcmp(name, "defDigestMethodId"))
    dsigCtx->defDigestMethodId = xmlSecTransformId_get(value_obj);
  else if (!strcmp(name, "signKey"))
    dsigCtx->signKey = xmlSecKeyPtr_get(value_obj);
  else if (!strcmp(name, "operation"))
    dsigCtx->operation = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "result"))
    dsigCtx->result = xmlSecBufferPtr_get(value_obj);
  else if (!strcmp(name, "status"))
    dsigCtx->status = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "signMethod"))
    dsigCtx->signMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "c14nMethod"))
    dsigCtx->c14nMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "preSignMemBufMethod"))
    dsigCtx->preSignMemBufMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "signValueNode"))
    dsigCtx->signValueNode = xmlNodePtr_get(value_obj);
  else if (!strcmp(name, "id"))
    dsigCtx->id = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "signedInfoReferences"))
    dsigCtx->signedInfoReferences = *(xmlSecPtrListPtr_get(value_obj));
  else if (!strcmp(name, "manifestReferences"))
    dsigCtx->manifestReferences = *(xmlSecPtrListPtr_get(value_obj));

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #2
0
PyObject *xmlSecTransformCtx_setattr(PyObject *self, PyObject *args) {
  PyObject *transformCtx_obj, *value_obj;
  xmlSecTransformCtxPtr transformCtx;
  const char *name;

  if (CheckArgs(args, "OS?:transformCtxSetAttr")) {
    if (!PyArg_ParseTuple(args, "OsO:transformCtxSetAttr",
			  &transformCtx_obj, &name, &value_obj))
      return NULL;
  }
  else return NULL;

  transformCtx = xmlSecTransformCtxPtr_get(transformCtx_obj);
    
  if (!strcmp(name, "flags"))
    transformCtx->flags = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "flags2"))
    transformCtx->flags2 = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "enabledUris"))
    transformCtx->enabledUris = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "enabledTransforms"))
    transformCtx->enabledTransforms = *(xmlSecPtrListPtr_get(value_obj));
  else if (!strcmp(name, "preExecCallback"))
    if (value_obj != Py_None) {
      if (TransformCtxPreExecuteCallbacks == NULL)
	TransformCtxPreExecuteCallbacks = xmlHashCreate(HASH_TABLE_SIZE);
      xmlHashAddEntry2(TransformCtxPreExecuteCallbacks,
		       transformCtx->uri, transformCtx->xptrExpr, value_obj);
      Py_XINCREF(value_obj);
      transformCtx->preExecCallback = xmlsec_TransformCtxPreExecuteCallback;
    }
    else
      transformCtx->preExecCallback = NULL;
  else if (!strcmp(name, "result"))
    transformCtx->result = xmlSecBufferPtr_get(value_obj);
  else if (!strcmp(name, "status"))
    transformCtx->status = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "uri"))
    transformCtx->uri = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "xptrExpr"))
    transformCtx->xptrExpr = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "first"))
    transformCtx->first = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "last"))
    transformCtx->last = xmlSecTransformPtr_get(value_obj);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #3
0
PyObject *xmlSecEncCtx_setattr(PyObject *self, PyObject *args) {
  PyObject *encCtx_obj, *value_obj;
  xmlSecEncCtxPtr encCtx;
  const char *name;

  if (CheckArgs(args, "OSO:encCtxSetAttr")) {
    if (!PyArg_ParseTuple(args, "OsO:encCtxSetAttr",
			  &encCtx_obj, &name, &value_obj))
      return NULL;
  }
  else return NULL;

  encCtx = xmlSecEncCtxPtr_get(encCtx_obj);
    
  if (!strcmp(name, "flags"))
    encCtx->flags = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "flags2"))
    encCtx->flags2 = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "mode"))
    encCtx->mode = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "keyInfoReadCtx"))
    encCtx->keyInfoReadCtx = *(xmlSecKeyInfoCtxPtr_get(value_obj));
  else if (!strcmp(name, "keyInfoWriteCtx"))
    encCtx->keyInfoWriteCtx = *(xmlSecKeyInfoCtxPtr_get(value_obj));
  else if (!strcmp(name, "transformCtx"))
    encCtx->transformCtx = *(xmlSecTransformCtxPtr_get(value_obj));
  else if (!strcmp(name, "defEncMethodId"))
    encCtx->defEncMethodId = xmlSecTransformId_get(value_obj);
  else if (!strcmp(name, "encKey"))
    encCtx->encKey = xmlSecKeyPtr_get(value_obj);
  else if (!strcmp(name, "operation"))
    encCtx->operation = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "result"))
    encCtx->result = xmlSecBufferPtr_get(value_obj);
  else if (!strcmp(name, "resultBase64Encoded"))
    encCtx->resultBase64Encoded = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "resultReplaced"))
    encCtx->resultReplaced = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "encMethod"))
    encCtx->encMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "id"))
    encCtx->id = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "type"))
    encCtx->type = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "mimeType"))
    encCtx->mimeType = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "encoding"))
    encCtx->encoding = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "recipient"))
    encCtx->recipient = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "carriedKeyName"))
    encCtx->carriedKeyName = (xmlChar *)PyString_AsString(value_obj);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #4
0
PyObject *xmlSecDSigReferenceCtx_setattr(PyObject *self, PyObject *args) {
  PyObject *dsigRefCtx_obj, *value_obj;
  xmlSecDSigReferenceCtxPtr dsigRefCtx;
  const char *name;

  if (CheckArgs(args, "OS?:dsigReferenceCtxSetAttr")) {
    if (!PyArg_ParseTuple(args, "OsO:dsigReferenceCtxSetAttr",
			  &dsigRefCtx_obj, &name, &value_obj))
      return NULL;
  }
  else return NULL;

  dsigRefCtx = xmlSecDSigReferenceCtxPtr_get(dsigRefCtx_obj);
    
  if (!strcmp(name, "dsigCtx"))
    dsigRefCtx->dsigCtx = xmlSecDSigCtxPtr_get(value_obj);
  else if (!strcmp(name, "origin"))
    dsigRefCtx->origin = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "transformCtx"))
    dsigRefCtx->transformCtx = *(xmlSecTransformCtxPtr_get(value_obj));
  else if (!strcmp(name, "digestMethod"))
    dsigRefCtx->digestMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "result"))
    dsigRefCtx->result = xmlSecBufferPtr_get(value_obj);
  else if (!strcmp(name, "status"))
    dsigRefCtx->status = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "preDigestMemBufMethod"))
    dsigRefCtx->preDigestMemBufMethod = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "id"))
    dsigRefCtx->id = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "uri"))
    dsigRefCtx->uri = (xmlChar *)PyString_AsString(value_obj);
  else if (!strcmp(name, "type"))
    dsigRefCtx->type = (xmlChar *)PyString_AsString(value_obj);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #5
0
PyObject *xmlSecTransform_setattr(PyObject *self, PyObject *args) {
  PyObject *transform_obj, *value_obj;
  xmlSecTransformPtr transform;
  const char *name;

  if (CheckArgs(args, "OS?:transformSetAttr")) {
    if (!PyArg_ParseTuple(args, "OsO:transformSetAttr",
			  &transform_obj, &name, &value_obj))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
    
  if (!strcmp(name, "id"))
    transform->id = xmlSecTransformId_get(value_obj);
  else if (!strcmp(name, "operation"))
    transform->operation = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "status"))
    transform->status = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "hereNode"))
    transform->hereNode = xmlNodePtr_get(value_obj);
  else if (!strcmp(name, "next"))
    transform->next = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "prev"))
    transform->prev = xmlSecTransformPtr_get(value_obj);
  else if (!strcmp(name, "inBuf"))
    transform->inBuf = *(xmlSecBufferPtr_get(value_obj));
  else if (!strcmp(name, "outBuf"))
    transform->outBuf = *(xmlSecBufferPtr_get(value_obj));
  else if (!strcmp(name, "inNodes"))
    transform->inNodes = xmlSecNodeSetPtr_get(value_obj);
  else if (!strcmp(name, "outNodes"))
    transform->outNodes = xmlSecNodeSetPtr_get(value_obj);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #6
0
PyObject *xmlsec_TransformMemBufGetBuffer(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;
  xmlSecBufferPtr buf;

  if (CheckArgs(args, "O:transformMemBufGetBuffer")) {
    if (!PyArg_ParseTuple(args, "O:transformMemBufGetBuffer", &transform_obj))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
  buf = xmlSecTransformMemBufGetBuffer(transform);

  return (wrap_xmlSecBufferPtr(buf));
}
Exemple #7
0
PyObject *xmlsec_TransformDestroy(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;

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

  transform = xmlSecTransformPtr_get(transform_obj);
  xmlSecTransformDestroy(transform);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #8
0
PyObject *xmlsec_TransformVisa3DHackSetID(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;
  const xmlChar *id;
  int ret;

  if (CheckArgs(args, "OS:transformVisa3DHackSetID")) {
    if(!PyArg_ParseTuple(args, (char *) "Os:transformVisa3DHackSetID",
			 &transform_obj, &id))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
  ret = xmlSecTransformVisa3DHackSetID(transform, id);

  return (wrap_int(ret));
}
Exemple #9
0
PyObject *xmlsec_TransformBase64SetLineSize(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;
  xmlSecSize lineSize;

  if (CheckArgs(args, "OI:transformBase64SetLineSize")) {
    if(!PyArg_ParseTuple(args, (char *) "Oi:transformBase64SetLineSize",
			 &transform_obj, &lineSize))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
  xmlSecTransformBase64SetLineSize(transform, lineSize);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #10
0
PyObject *xmlsec_TransformSetKeyReq(PyObject *self, PyObject *args) {
  PyObject *transform_obj, *keyReq_obj;
  xmlSecTransformPtr transform;
  xmlSecKeyReqPtr keyReq;
  int ret;

  if (CheckArgs(args, "OO:transformSetKeyReq")) {
    if(!PyArg_ParseTuple(args, (char *) "OO:transformSetKeyReq",
			 &transform_obj, &keyReq_obj))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
  keyReq = xmlSecKeyReqPtr_get(keyReq_obj);
  ret = xmlSecTransformSetKeyReq(transform, keyReq);

  return (wrap_int(ret));
}
Exemple #11
0
PyObject *xmlSecTransform_getattr(PyObject *self, PyObject *args) {
  PyObject *transform_obj;
  xmlSecTransformPtr transform;
  const char *attr;

  if (CheckArgs(args, "OS:transformGetAttr")) {
    if (!PyArg_ParseTuple(args, "Os:transformGetAttr",
			  &transform_obj, &attr))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[ssssssssss]", "id", "operation", "status",
			 "hereNode", "next", "prev", "inBuf", "outBuf",
			 "inNodes", "outNodes");
  if (!strcmp(attr, "id"))
    return (wrap_xmlSecTransformId(transform->id));
  if (!strcmp(attr, "operation"))
    return (wrap_int(transform->operation));
  if (!strcmp(attr, "status"))
    return (wrap_int(transform->status));
  if (!strcmp(attr, "hereNode"))
    return (wrap_xmlNodePtr(transform->hereNode));
  if (!strcmp(attr, "next"))
    return (wrap_xmlSecTransformPtr(transform->next));
  if (!strcmp(attr, "prev"))
    return (wrap_xmlSecTransformPtr(transform->prev));
  if (!strcmp(attr, "inBuf"))
    return (wrap_xmlSecBufferPtr(&(transform->inBuf)));
  if (!strcmp(attr, "outBuf"))
    return (wrap_xmlSecBufferPtr(&(transform->outBuf)));
  if (!strcmp(attr, "inNodes"))
    return (wrap_xmlSecNodeSetPtr(transform->inNodes));
  if (!strcmp(attr, "outNodes"))
    return (wrap_xmlSecNodeSetPtr(transform->outNodes));

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #12
0
PyObject *xmlsec_TransformXPointerSetExpr(PyObject *self, PyObject *args) {
  PyObject *transform_obj, *hereNode_obj;
  xmlSecTransformPtr transform;
  const xmlChar *expr;
  xmlSecNodeSetType nodeSetType;
  xmlNodePtr hereNode;
  int ret;

  if (CheckArgs(args, "OSIO:transformXPointerSetExpr")) {
    if(!PyArg_ParseTuple(args, (char *) "OsiO:transformXPointerSetExpr",
			 &transform_obj, &expr, &nodeSetType, &hereNode_obj))
      return NULL;
  }
  else return NULL;

  transform = xmlSecTransformPtr_get(transform_obj);
  hereNode = xmlNodePtr_get(hereNode_obj);
  ret = xmlSecTransformXPointerSetExpr(transform, expr, nodeSetType, hereNode);

  return (wrap_int(ret));
}