Beispiel #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);
}
Beispiel #2
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);
}
Beispiel #3
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));
}
Beispiel #4
0
PyObject *xmlsec_TransformCreate(PyObject *self, PyObject *args) {
  PyObject *id_obj;
  xmlSecTransformId id;
  xmlSecTransformPtr transform;

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

  id = xmlSecTransformId_get(id_obj);
  transform = xmlSecTransformCreate(id);

  return (wrap_xmlSecTransformPtr(transform));
}
Beispiel #5
0
PyObject *xmlsec_DSigCtxEnableSignatureTransform(PyObject *self, PyObject *args) {
  PyObject *dsigCtx_obj, *transformId_obj;
  xmlSecDSigCtxPtr dsigCtx;
  xmlSecTransformId transformId;
  int ret;

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

  dsigCtx = xmlSecDSigCtxPtr_get(dsigCtx_obj);
  transformId = xmlSecTransformId_get(transformId_obj);
  ret = xmlSecDSigCtxEnableSignatureTransform(dsigCtx, transformId);

  return (wrap_int(ret));
}
Beispiel #6
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));
}
Beispiel #7
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));
}
Beispiel #8
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);
}
Beispiel #9
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));
}
Beispiel #10
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));
}
Beispiel #11
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));
}