Ejemplo n.º 1
0
static int xmlsec_NodeSetWalkCallback(xmlSecNodeSetPtr nset, xmlNodePtr cur,
				      xmlNodePtr parent, void *data) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup2(NodeSetWalkCallbacks, (const xmlChar *)nset->doc->name,
			nset->doc->URL);

  args = Py_BuildValue((char *) "OOOO", wrap_xmlSecNodeSetPtr(nset),
		       wrap_xmlNodePtr(cur), wrap_xmlNodePtr(parent),
		       PyCObject_FromVoidPtr((void *) data, NULL));

  /* Protect refcount against reentrant manipulation of callback hash */
  Py_INCREF(func);
  result = PyEval_CallObject(func, args);
  Py_DECREF(func);
  Py_DECREF(args);

  return (PyInt_AsLong(result));
}
Ejemplo n.º 2
0
PyObject *xmlsec_TmplEncDataGetEncMethodNode(PyObject *self, PyObject *args) {
  PyObject *encNode_obj;
  xmlNodePtr encNode;
  xmlNodePtr encMethNode;

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

  encNode = xmlNodePtr_get(encNode_obj);
  encMethNode = xmlSecTmplEncDataGetEncMethodNode(encNode);

  return (wrap_xmlNodePtr(encMethNode));
}
Ejemplo n.º 3
0
PyObject *xmlsec_TmplKeyInfoAddKeyValue(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj;
  xmlNodePtr keyInfoNode;
  xmlNodePtr keyValue;

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

  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  keyValue = xmlSecTmplKeyInfoAddKeyValue(keyInfoNode);

  return (wrap_xmlNodePtr(keyValue));
}
Ejemplo n.º 4
0
PyObject *xmlsec_TmplKeyInfoAddX509Data(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj;
  xmlNodePtr keyInfoNode;
  xmlNodePtr X509Data;

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

  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  X509Data = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);

  return (wrap_xmlNodePtr(X509Data));
}
Ejemplo n.º 5
0
PyObject *xmlsec_TmplEncDataEnsureCipherValue(PyObject *self, PyObject *args) {
  PyObject *encNode_obj;
  xmlNodePtr encNode;
  xmlNodePtr cipherValNode;

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

  encNode = xmlNodePtr_get(encNode_obj);
  cipherValNode = xmlSecTmplEncDataEnsureCipherValue(encNode);

  return (wrap_xmlNodePtr(cipherValNode));
}
Ejemplo n.º 6
0
PyObject *xmlsec_TmplSignatureGetC14NMethodNode(PyObject *self, PyObject *args) {
  PyObject * signNode_obj;
  xmlNodePtr signNode;
  xmlNodePtr node;
  
  if (CheckArgs(args, "O:tmplSignatureGetC14NMethodNode")) {
    if (!PyArg_ParseTuple(args, "O:tmplSignatureGetC14NMethodNode",
			  &signNode_obj))
      return NULL;
  }
  else return NULL;

  signNode = xmlNodePtr_get(signNode_obj);
  node = xmlSecTmplSignatureGetC14NMethodNode(signNode);
  
  return (wrap_xmlNodePtr(node));
}
Ejemplo n.º 7
0
PyObject *xmlsec_TmplKeyInfoAddKeyName(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj;
  xmlNodePtr keyInfoNode;
  const xmlChar *name;
  xmlNodePtr keyName;

  if (CheckArgs(args, "Os:tmplKeyInfoAddKeyName")) {
    if (!PyArg_ParseTuple(args, "Oz:tmplKeyInfoAddKeyName",
			  &keyInfoNode_obj, &name))
      return NULL;
  }
  else return NULL;

  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  keyName = xmlSecTmplKeyInfoAddKeyName(keyInfoNode, name);

  return (wrap_xmlNodePtr(keyName));
}
Ejemplo n.º 8
0
PyObject *xmlsec_TmplReferenceListAddKeyReference(PyObject *self, PyObject *args) {
  PyObject *encNode_obj;
  xmlNodePtr encNode;
  const xmlChar *uri = NULL;
  xmlNodePtr keyRefNode;

  if (CheckArgs(args, "Os:tmplReferenceListAddKeyReference")) {
    if (!PyArg_ParseTuple(args, "Oz:tmplReferenceListAddKeyReference",
			  &encNode_obj, &uri))
      return NULL;
  }
  else return NULL;

  encNode = xmlNodePtr_get(encNode_obj);
  keyRefNode = xmlSecTmplReferenceListAddKeyReference(encNode, uri);

  return (wrap_xmlNodePtr(keyRefNode));
}
Ejemplo n.º 9
0
PyObject *xmlsec_TmplSignatureEnsureKeyInfo(PyObject *self, PyObject *args) {
  PyObject *signNode_obj;
  xmlNodePtr signNode;
  const xmlChar *id = NULL;
  xmlNodePtr eki;

  if (CheckArgs(args, "Os:tmplSignatureEnsureKeyInfo")) {
    if (!PyArg_ParseTuple(args, "Oz:tmplSignatureEnsureKeyInfo",
			  &signNode_obj, &id))
      return NULL;
  }
  else return NULL;

  signNode = xmlNodePtr_get(signNode_obj);
  eki = xmlSecTmplSignatureEnsureKeyInfo(signNode, id);

  return (wrap_xmlNodePtr(eki));
}
Ejemplo n.º 10
0
PyObject *xmlsec_TmplEncDataEnsureEncProperties(PyObject *self, PyObject *args) {
  PyObject *encNode_obj;
  xmlNodePtr encNode;
  const xmlChar *id = NULL;
  xmlNodePtr encPropNode;

  if (CheckArgs(args, "Os:tmplEncDataEnsureEncProperties")) {
    if (!PyArg_ParseTuple(args, "Oz:tmplEncDataEnsureEncProperties",
			  &encNode_obj, &id))
      return NULL;
  }
  else return NULL;

  encNode = xmlNodePtr_get(encNode_obj);
  encPropNode = xmlSecTmplEncDataEnsureEncProperties(encNode, id);

  return (wrap_xmlNodePtr(encPropNode));
}
Ejemplo n.º 11
0
static xmlSecKeyPtr xmlsec_GetKeyCallback(xmlNodePtr keyInfoNode,
					  xmlSecKeyInfoCtxPtr keyInfoCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup(GetKeyCallbacks,
		       keyInfoCtx->keysMngr->keysStore->id->name);

  args = Py_BuildValue((char *) "OO", wrap_xmlNodePtr(keyInfoNode),
		       wrap_xmlSecKeyInfoCtxPtr(keyInfoCtx));

  Py_INCREF(func);
  result = PyEval_CallObject(func, args);
  Py_DECREF(func);
  Py_DECREF(args);

  return (xmlSecKeyPtr_get(result));
}
Ejemplo n.º 12
0
PyObject *xmlsec_TmplObjectAddManifest(PyObject *self, PyObject *args) {
  PyObject *objectNode_obj;
  xmlNodePtr objectNode;
  const xmlChar *id = NULL;
  xmlNodePtr manifest;

  if (CheckArgs(args, "Os:tmplObjectAddManifest")) {
    if (!PyArg_ParseTuple(args, "Oz:tmplObjectAddManifest", &objectNode_obj,
			  &id))
      return NULL;
  }
  else return NULL;

  objectNode = xmlNodePtr_get(objectNode_obj);
  manifest = xmlSecTmplObjectAddManifest(objectNode, id);

  return (wrap_xmlNodePtr(manifest));
}
Ejemplo n.º 13
0
PyObject *xmlsec_TmplKeyInfoAddRetrievalMethod(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj;
  xmlNodePtr keyInfoNode;
  const xmlChar *uri = NULL;
  const xmlChar *type = NULL;
  xmlNodePtr node;

  if (CheckArgs(args, "Oss:tmplKeyInfoAddRetrievalMethod")) {
    if (!PyArg_ParseTuple(args, "Ozz:tmplKeyInfoAddRetrievalMethod",
			  &keyInfoNode_obj, &uri, &type))
      return NULL;
  }
  else return NULL;
  
  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  node = xmlSecTmplKeyInfoAddRetrievalMethod(keyInfoNode, uri, type);

  return (wrap_xmlNodePtr(node));
}
Ejemplo n.º 14
0
PyObject *xmlsec_TmplEncDataAddEncProperty(PyObject *self, PyObject *args) {
  PyObject *encNode_obj;
  xmlNodePtr encNode;
  const xmlChar *id = NULL;
  const xmlChar *target = NULL;
  xmlNodePtr encPropNode;

  if (CheckArgs(args, "Oss:tmplEncDataAddEncProperty")) {
    if (!PyArg_ParseTuple(args, "Ozz:tmplEncDataAddEncProperty", &encNode_obj,
			  &id, &target))
      return NULL;
  }
  else return NULL;

  encNode = xmlNodePtr_get(encNode_obj);
  encPropNode = xmlSecTmplEncDataAddEncProperty(encNode, id, target);

  return (wrap_xmlNodePtr(encPropNode));
}
Ejemplo n.º 15
0
PyObject *xmlsec_TmplObjectAddSignProperties(PyObject *self, PyObject *args) {
  PyObject *objectNode_obj;
  xmlNodePtr objectNode;
  const xmlChar *id = NULL;
  const xmlChar *target = NULL;
  xmlNodePtr signProperties;

  if (CheckArgs(args, "Oss:tmplObjectAddSignProperties")) {
    if (!PyArg_ParseTuple(args, "Ozz:tmplObjectAddSignProperties",
			  &objectNode_obj, &id, &target))
    return NULL;
  }
  else return NULL;

  objectNode = xmlNodePtr_get(objectNode_obj);
  signProperties = xmlSecTmplObjectAddSignProperties(objectNode, id, target);

  return (wrap_xmlNodePtr(signProperties));
}
Ejemplo n.º 16
0
PyObject *xmlsec_TmplReferenceAddTransform(PyObject *self, PyObject *args) {
  PyObject *referenceNode_obj, *transformId_obj;
  xmlNodePtr referenceNode;
  xmlSecTransformId transformId;
  xmlNodePtr transform;

  if (CheckArgs(args, "OO:tmplReferenceAddTransform")) {
    if (!PyArg_ParseTuple(args, "OO:tmplReferenceAddTransform",
			  &referenceNode_obj, &transformId_obj))
      return NULL;
  }
  else return NULL;

  referenceNode = xmlNodePtr_get(referenceNode_obj);
  transformId = xmlSecTransformId_get(transformId_obj);
  transform = xmlSecTmplReferenceAddTransform(referenceNode, transformId);

  return (wrap_xmlNodePtr(transform));
}
Ejemplo n.º 17
0
static int xmlsec_KeyDataXmlWriteMethod(xmlSecKeyDataId id, xmlSecKeyPtr key,
					xmlNodePtr node,
					xmlSecKeyInfoCtxPtr keyInfoCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup(KeyDataXmlWriteMethods, id->name);

  args = Py_BuildValue((char *) "OOOO", wrap_xmlSecKeyDataId(id),
		       wrap_xmlSecKeyPtr(key), wrap_xmlNodePtr(node),
		       wrap_xmlSecKeyInfoCtxPtr(keyInfoCtx));

  Py_INCREF(func);
  result = PyEval_CallObject(func, args);
  Py_DECREF(func);
  Py_DECREF(args);

  return (PyInt_AsLong(result));
}
Ejemplo n.º 18
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);
}
Ejemplo n.º 19
0
PyObject *xmlsec_TmplSignatureAddObject(PyObject *self, PyObject *args) {
  PyObject * signNode_obj;
  xmlNodePtr signNode;
  const xmlChar *id = NULL;
  const xmlChar *mimeType = NULL;
  const xmlChar *encoding = NULL;
  xmlNodePtr obj;

  if (CheckArgs(args, "Osss:tmplSignatureAddObject")) {
    if (!PyArg_ParseTuple(args, "Ozzz:tmplSignatureAddObject", &signNode_obj,
			&id, &mimeType, &encoding))
      return NULL;
  }
  else return NULL;

  signNode = xmlNodePtr_get(signNode_obj);
  obj = xmlSecTmplSignatureAddObject(signNode, id, mimeType, encoding);

  return (wrap_xmlNodePtr(obj));
}
Ejemplo n.º 20
0
PyObject *xmlsec_TmplCipherReferenceAddTransform(PyObject *self, PyObject *args) {
  PyObject *cipherReferenceNode_obj, *transformId_obj;
  xmlNodePtr cipherReferenceNode;
  xmlSecTransformId transformId;
  xmlNodePtr dsigTransNode;

  if (CheckArgs(args, "OO:tmplCipherReferenceAddTransform")) {
    if (!PyArg_ParseTuple(args, "OO:tmplCipherReferenceAddTransform",
			  &cipherReferenceNode_obj, &transformId_obj))
      return NULL;
  }
  else return NULL;

  cipherReferenceNode = xmlNodePtr_get(cipherReferenceNode_obj);
  transformId = xmlSecTransformId_get(transformId_obj);
  dsigTransNode = xmlSecTmplCipherReferenceAddTransform(cipherReferenceNode,
							transformId);

  return (wrap_xmlNodePtr(dsigTransNode));
}
Ejemplo n.º 21
0
static int xmlsec_TransformNodeWriteMethod(xmlSecTransformPtr transform,
					   xmlNodePtr node,
					   xmlSecTransformCtxPtr transformCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup2(TransformNodeWriteMethods, transform->id->name,
			transform->id->href);

  args = Py_BuildValue((char *) "OOO", wrap_xmlSecTransformPtr(transform),
		       wrap_xmlNodePtr(node),
		       wrap_xmlSecTransformCtxPtr(transformCtx));

  Py_INCREF(func);
  result = PyEval_CallObject(func, args);
  Py_DECREF(func);
  Py_DECREF(args);

  return (PyInt_AsLong(result));
}
Ejemplo n.º 22
0
PyObject *xmlsec_TmplSignatureCreate(PyObject *self, PyObject *args) {
  PyObject *doc_obj, *c14nMethodId_obj, *signMethodId_obj;
  xmlDocPtr doc = NULL;
  xmlSecTransformId c14nMethodId;
  xmlSecTransformId signMethodId;
  const xmlChar *id = NULL;
  xmlNodePtr node;
  
  if (CheckArgs(args, "oOOs:tmplSignatureCreate")) {
    if (!PyArg_ParseTuple(args, "OOOz:tmplSignatureCreate", &doc_obj,
			  &c14nMethodId_obj, &signMethodId_obj, &id))
      return NULL;
  }
  else return NULL;
    
  doc = xmlDocPtr_get(doc_obj);
  c14nMethodId = xmlSecTransformId_get(c14nMethodId_obj);
  signMethodId = xmlSecTransformId_get(signMethodId_obj);

  node = xmlSecTmplSignatureCreate(doc, c14nMethodId, signMethodId, id);

  return (wrap_xmlNodePtr(node));
}
Ejemplo n.º 23
0
PyObject *xmlsec_TmplEncDataCreate(PyObject *self, PyObject *args) {
  PyObject *doc_obj, *encMethodId_obj;
  xmlDocPtr doc = NULL;
  xmlSecTransformId encMethodId = NULL;
  const xmlChar *id = NULL;
  const xmlChar *type = NULL;
  const xmlChar *mimeType = NULL;
  const xmlChar *encoding = NULL;
  xmlNodePtr encDataNode;

  if (CheckArgs(args, "oossss:tmplEncDataCreate")) {
    if (!PyArg_ParseTuple(args, "OOzzzz:tmplEncDataCreate", &doc_obj,
			  &encMethodId_obj, &id, &type, &mimeType, &encoding))
      return NULL;
  }
  else return NULL;

  doc = xmlDocPtr_get(doc_obj);
  encMethodId = xmlSecTransformId_get(encMethodId_obj);
  encDataNode = xmlSecTmplEncDataCreate(doc, encMethodId,
					id, type, mimeType, encoding);

  return (wrap_xmlNodePtr(encDataNode));
}
Ejemplo n.º 24
0
PyObject *xmlsec_TmplSignatureAddReference(PyObject *self, PyObject *args) {
  PyObject *signNode_obj, *digestMethodId_obj;
  xmlNodePtr signNode;
  xmlSecTransformId digestMethodId;
  const xmlChar *id = NULL;
  const xmlChar *uri = NULL;
  const xmlChar *type = NULL;
  xmlNodePtr ref;

  if (CheckArgs(args, "OOsss:tmplSignatureAddReference")) {
    if (!PyArg_ParseTuple(args, "OOzzz:tmplSignatureAddReference",
			  &signNode_obj, &digestMethodId_obj,
			  &id, &uri, &type))
      return NULL;
  }
  else return NULL;

  signNode = xmlNodePtr_get(signNode_obj);
  digestMethodId = xmlSecTransformId_get(digestMethodId_obj);
  ref = xmlSecTmplSignatureAddReference(signNode, digestMethodId,
					id, uri, type);

  return (wrap_xmlNodePtr(ref));
}
Ejemplo n.º 25
0
PyObject *xmlsec_TmplKeyInfoAddEncryptedKey(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj, *encMethodId_obj;
  xmlNodePtr keyInfoNode;
  xmlSecTransformId encMethodId = NULL;
  const xmlChar *id = NULL;
  const xmlChar *type = NULL;
  const xmlChar *recipient = NULL;
  xmlNodePtr encKeyNode;

  if (CheckArgs(args, "Oosss:tmplKeyInfoAddEncryptedKey")) {
    if (!PyArg_ParseTuple(args, "OOzzz:tmplKeyInfoAddEncryptedKey",
			  &keyInfoNode_obj, &encMethodId_obj, &id, &type,
			  &recipient))
      return NULL;
  }
  else return NULL;

  encMethodId = xmlSecTransformId_get(encMethodId_obj);
  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  encKeyNode = xmlSecTmplKeyInfoAddEncryptedKey(keyInfoNode, encMethodId,
						id, type, recipient);

  return (wrap_xmlNodePtr(encKeyNode));
}
Ejemplo n.º 26
0
PyObject *xmlSecDSigCtx_getattr(PyObject *self, PyObject *args) {
  PyObject *dsigCtx_obj;
  xmlSecDSigCtxPtr dsigCtx;
  const char *attr;

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

  dsigCtx = xmlSecDSigCtxPtr_get(dsigCtx_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[sssssssssssssssssssss]", "flags",
			 "flags2", "keyInfoReadCtx", "keyInfoWriteCtx",
			 "transformCtx", "enabledReferenceUris",
			 "enabledReferenceTransforms",
			 "defSignMethodId",
			 "defC14NMethodId", "defDigestMethodId",
			 "signKey", "operation", "result", "status",
			 "signMethod", "c14nMethod", "preSignMemBufMethod",
			 "signValueNode", "id", "signedInfoReferences",
			 "manifestReferences");
  if (!strcmp(attr, "flags")) return (wrap_int(dsigCtx->flags));
  if (!strcmp(attr, "flags2")) return (wrap_int(dsigCtx->flags2));
  if (!strcmp(attr, "keyInfoReadCtx"))
    return (wrap_xmlSecKeyInfoCtxPtr(&(dsigCtx->keyInfoReadCtx)));
  if (!strcmp(attr, "keyInfoWriteCtx"))
    return (wrap_xmlSecKeyInfoCtxPtr(&(dsigCtx->keyInfoWriteCtx)));
  if (!strcmp(attr, "transformCtx"))
    return (wrap_xmlSecTransformCtxPtr(&(dsigCtx->transformCtx)));
  if (!strcmp(attr, "enabledReferenceUris"))
    return (wrap_int(dsigCtx->enabledReferenceUris));
  if (!strcmp(attr, "enabledReferenceTransforms"))
    return (wrap_xmlSecPtrListPtr(dsigCtx->enabledReferenceTransforms));
  if (!strcmp(attr, "defSignMethodId"))
    return (wrap_xmlSecTransformId(dsigCtx->defSignMethodId));
  if (!strcmp(attr, "defC14NMethodId"))
    return (wrap_xmlSecTransformId(dsigCtx->defC14NMethodId));
  if (!strcmp(attr, "defDigestMethodId"))
    return (wrap_xmlSecTransformId(dsigCtx->defDigestMethodId));
  if (!strcmp(attr, "signKey")) return (wrap_xmlSecKeyPtr(dsigCtx->signKey));
  if (!strcmp(attr, "operation")) return (wrap_int(dsigCtx->operation));
  if (!strcmp(attr, "result")) return (wrap_xmlSecBufferPtr(dsigCtx->result));
  if (!strcmp(attr, "status")) return (wrap_int(dsigCtx->status));
  if (!strcmp(attr, "signMethod"))
    return (wrap_xmlSecTransformPtr(dsigCtx->signMethod));
  if (!strcmp(attr, "c14nMethod"))
    return (wrap_xmlSecTransformPtr(dsigCtx->c14nMethod));
  if (!strcmp(attr, "preSignMemBufMethod"))
    return (wrap_xmlSecTransformPtr(dsigCtx->preSignMemBufMethod));
  if (!strcmp(attr, "signValueNode"))
    return (wrap_xmlNodePtr(dsigCtx->signValueNode));
  if (!strcmp(attr, "id")) return (wrap_xmlCharPtr(dsigCtx->id));
  if (!strcmp(attr, "signedInfoReferences"))
    return (wrap_xmlSecPtrListPtr(&(dsigCtx->signedInfoReferences)));
  if (!strcmp(attr, "manifestReferences"))
    return (wrap_xmlSecPtrListPtr(&(dsigCtx->manifestReferences)));
  Py_INCREF(Py_None);
  return (Py_None);
}
Ejemplo n.º 27
0
Archivo: xmlenc.c Proyecto: badbole/sh
PyObject *xmlSecEncCtx_getattr(PyObject *self, PyObject *args) {
  PyObject *encCtx_obj;
  xmlSecEncCtxPtr encCtx;
  const char *attr;

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

  encCtx = xmlSecEncCtxPtr_get(encCtx_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[sssssssssssssssssssssss]", "flags",
			 "flags2", "mode", "keyInfoReadCtx", "keyInfoWriteCtx",
			 "transformCtx", "defEncMethodId",
			 "encKey", "operation", "result", "resultBase64Encoded",
			 "resultReplaced", "encMethod",
			 "id", "type", "mimeType", "encoding", "recipient",
			 "carriedKeyName", "encDataNode", "encMethodNode",
			 "keyInfoNode", "cipherValueNode");
  if (!strcmp(attr, "flags"))
    return (wrap_int(encCtx->flags));
  if (!strcmp(attr, "flags2"))
    return (wrap_int(encCtx->flags2));
  if (!strcmp(attr, "mode"))
    return (wrap_int(encCtx->mode));
  if (!strcmp(attr, "keyInfoReadCtx"))
    return (wrap_xmlSecKeyInfoCtxPtr(&(encCtx->keyInfoReadCtx)));
  if (!strcmp(attr, "keyInfoWriteCtx"))
    return (wrap_xmlSecKeyInfoCtxPtr(&(encCtx->keyInfoWriteCtx)));
  if (!strcmp(attr, "transformCtx"))
    return (wrap_xmlSecTransformCtxPtr(&(encCtx->transformCtx)));
  if (!strcmp(attr, "defEncMethodId"))
    return (wrap_xmlSecTransformId(encCtx->defEncMethodId));
  if (!strcmp(attr, "encKey"))
    return (wrap_xmlSecKeyPtr(encCtx->encKey));
  if (!strcmp(attr, "operation"))
    return (wrap_int(encCtx->operation));
  if (!strcmp(attr, "result"))
    return (wrap_xmlSecBufferPtr(encCtx->result));
  if (!strcmp(attr, "resultBase64Encoded"))
    return (wrap_int(encCtx->resultBase64Encoded));
  if (!strcmp(attr, "resultReplaced"))
    return (wrap_int(encCtx->resultReplaced));
  if (!strcmp(attr, "encMethod"))
    return (wrap_xmlSecTransformPtr(encCtx->encMethod));
  if (!strcmp(attr, "id"))
    return (wrap_xmlCharPtr(encCtx->id));
  if (!strcmp(attr, "type"))
    return (wrap_xmlCharPtr(encCtx->type));
  if (!strcmp(attr, "mimeType"))
    return (wrap_xmlCharPtr(encCtx->mimeType));
  if (!strcmp(attr, "encoding"))
    return (wrap_xmlCharPtr(encCtx->encoding));
  if (!strcmp(attr, "recipient"))
    return (wrap_xmlCharPtr(encCtx->recipient));
  if (!strcmp(attr, "carriedKeyName"))
    return (wrap_xmlCharPtr(encCtx->carriedKeyName));
  if (!strcmp(attr, "encDataNode"))
    return (wrap_xmlNodePtr(encCtx->encDataNode));
  if (!strcmp(attr, "encMethodNode"))
    return (wrap_xmlNodePtr(encCtx->encMethodNode));
  if (!strcmp(attr, "keyInfoNode"))
    return (wrap_xmlNodePtr(encCtx->keyInfoNode));
  if (!strcmp(attr, "cipherValueNode"))
    return (wrap_xmlNodePtr(encCtx->cipherValueNode));

  Py_INCREF(Py_None);
  return (Py_None);
}