Esempio n. 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);
}
Esempio n. 2
0
File: xmlenc.c Progetto: badbole/sh
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);
}
Esempio n. 3
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);
}
Esempio n. 4
0
PyObject *xmlSecKeyInfoCtx_setattr(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj, *value_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  const char *name;

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

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
    
  if (!strcmp(name, "flags"))
    keyInfoCtx->flags = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "flags2"))
    keyInfoCtx->flags2 = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "keysMngr"))
    keyInfoCtx->keysMngr = xmlSecKeysMngrPtr_get(value_obj);
  else if (!strcmp(name, "mode"))
    keyInfoCtx->mode = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "enabledKeyData"))
    keyInfoCtx->enabledKeyData = *(xmlSecPtrListPtr_get(value_obj));
  else if (!strcmp(name, "base64LineSize"))
    keyInfoCtx->base64LineSize = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "retrievalMethodCtx"))
    keyInfoCtx->retrievalMethodCtx = *(xmlSecTransformCtxPtr_get(value_obj));
  else if (!strcmp(name, "maxRetrievalMethodLevel"))
    keyInfoCtx->maxRetrievalMethodLevel = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "encCtx"))
    keyInfoCtx->encCtx = xmlSecEncCtxPtr_get(value_obj);
  else if (!strcmp(name, "maxEncryptedKeyLevel"))
    keyInfoCtx->maxEncryptedKeyLevel = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "certsVerificationTime"))
    keyInfoCtx->certsVerificationTime = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "certsVerificationDepth"))
    keyInfoCtx->certsVerificationDepth = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "curRetrievalMethodLevel"))
    keyInfoCtx->curRetrievalMethodLevel = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "curEncryptedKeyLevel"))
    keyInfoCtx->curEncryptedKeyLevel = PyInt_AsLong(value_obj);
  else if (!strcmp(name, "keyReq"))
    keyInfoCtx->keyReq = *(xmlSecKeyReqPtr_get(value_obj));

  Py_INCREF(Py_None);
  return (Py_None);
}
Esempio n. 5
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);
}
Esempio n. 6
0
PyObject *xmlSecTransformCtx_getattr(PyObject *self, PyObject *args) {
  PyObject *transformCtx_obj;
  xmlSecTransformCtxPtr transformCtx;
  const char *attr;

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

  transformCtx = xmlSecTransformCtxPtr_get(transformCtx_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[sssssssssss]", "flags",
			 "flags2", "enabledUris", "enabledTransforms",
			 "preExecCallback", "result", "status", "uri",
			 "xptrExpr", "first", "last");
  if (!strcmp(attr, "flags"))
    return (wrap_int(transformCtx->flags));
  if (!strcmp(attr, "flags2"))
    return (wrap_int(transformCtx->flags2));
  if (!strcmp(attr, "enabledUris"))
    return (wrap_int(transformCtx->enabledUris));
  if (!strcmp(attr, "enabledTransforms"))
    return (wrap_xmlSecPtrListPtr(&(transformCtx->enabledTransforms)));
  if (!strcmp(attr, "preExecCallback"))
    return PyCObject_FromVoidPtr((void *) transformCtx->preExecCallback, NULL);
  if (!strcmp(attr, "result"))
    return (wrap_xmlSecBufferPtr(transformCtx->result));
  if (!strcmp(attr, "status"))
    return (wrap_int(transformCtx->status));
  if (!strcmp(attr, "uri"))
    return (wrap_xmlCharPtr(transformCtx->uri));
  if (!strcmp(attr, "xptrExpr"))
    return (wrap_xmlCharPtr(transformCtx->xptrExpr));
  if (!strcmp(attr, "first"))
    return (wrap_xmlSecTransformPtr(transformCtx->first));
  if (!strcmp(attr, "last"))
    return (wrap_xmlSecTransformPtr(transformCtx->last));

  Py_INCREF(Py_None);
  return (Py_None);
}
Esempio n. 7
0
PyObject *xmlsec_TransformNodeRead(PyObject *self, PyObject *args) {
  PyObject *node_obj, *transformCtx_obj;
  xmlNodePtr node;
  xmlSecTransformUsage usage;
  xmlSecTransformCtxPtr transformCtx;
  xmlSecTransformPtr transform;

  if (CheckArgs(args, "OIO:transformNodeRead")) {
    if(!PyArg_ParseTuple(args, (char *) "OiO:transformNodeRead", &node_obj,
			 &usage, &transformCtx_obj))
      return NULL;
  }
  else return NULL;

  node = xmlNodePtr_get(node_obj);
  transformCtx = xmlSecTransformCtxPtr_get(transformCtx_obj);
  transform = xmlSecTransformNodeRead(node, usage, transformCtx);

  return (wrap_xmlSecTransformPtr(transform));
}
Esempio n. 8
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);
}