Ejemplo n.º 1
0
PyObject *xmlsec_TransformCtxCreate(PyObject *self, PyObject *args) {
  xmlSecTransformCtxPtr ctx;

  ctx = xmlSecTransformCtxCreate();

  return (wrap_xmlSecTransformCtxPtr(ctx));
}
Ejemplo n.º 2
0
PyObject *xmlSecKeyInfoCtx_getattr(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  const char *attr;

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

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[ssssssssssssss]", "flags",
			 "flags2", "keysMngr", "mode", "enabledKeyData",
			 "base64LineSize", "retrievalMethodCtx",
			 "maxRetrievalMethodLevel", "encCtx",
			 "maxEncryptedKeyLevel", "certsVerificationTime",
			 "certsVerificationDepth", "curRetrievalMethodLevel",
			 "keyReq");
  if (!strcmp(attr, "flags"))
    return (wrap_int(keyInfoCtx->flags));
  if (!strcmp(attr, "flags2"))
    return (wrap_int(keyInfoCtx->flags2));
  if (!strcmp(attr, "keysMngr"))
    return (wrap_xmlSecKeysMngrPtr(keyInfoCtx->keysMngr));
  if (!strcmp(attr, "mode"))
    return (wrap_int(keyInfoCtx->mode));
  if (!strcmp(attr, "enabledKeyData"))
    return (wrap_xmlSecPtrListPtr(&(keyInfoCtx->enabledKeyData)));
  if (!strcmp(attr, "base64LineSize"))
    return (wrap_int(keyInfoCtx->base64LineSize));
  if (!strcmp(attr, "retrievalMethodCtx"))
    return (wrap_xmlSecTransformCtxPtr(&(keyInfoCtx->retrievalMethodCtx)));
  if (!strcmp(attr, "maxRetrievalMethodLevel"))
    return (wrap_int(keyInfoCtx->maxRetrievalMethodLevel));
  if (!strcmp(attr, "encCtx"))
    return (wrap_xmlSecEncCtxPtr(keyInfoCtx->encCtx));
  if (!strcmp(attr, "maxEncryptedKeyLevel"))
    return (wrap_int(keyInfoCtx->maxEncryptedKeyLevel));
  if (!strcmp(attr, "certsVerificationTime"))
    return (wrap_int(keyInfoCtx->certsVerificationTime));
  if (!strcmp(attr, "certsVerificationDepth"))
    return (wrap_int(keyInfoCtx->certsVerificationDepth));
  if (!strcmp(attr, "curRetrievalMethodLevel"))
    return (wrap_int(keyInfoCtx->curRetrievalMethodLevel));
  if (!strcmp(attr, "curEncryptedKeyLevel"))
    return (wrap_int(keyInfoCtx->curEncryptedKeyLevel));
  if (!strcmp(attr, "keyReq"))
    return wrap_xmlSecKeyReqPtr(&(keyInfoCtx->keyReq));

  Py_INCREF(Py_None);
  return (Py_None);
}
Ejemplo n.º 3
0
static int xmlsec_TransformCtxPreExecuteCallback(xmlSecTransformCtxPtr transformCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

  func = xmlHashLookup2(TransformCtxPreExecuteCallbacks,
			transformCtx->uri, transformCtx->xptrExpr);

  args = Py_BuildValue((char *) "O", wrap_xmlSecTransformCtxPtr(transformCtx));

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

  return (PyInt_AsLong(result));
}
Ejemplo n.º 4
0
static xmlSecTransformDataType xmlsec_TransformGetDataTypeMethod(xmlSecTransformPtr transform,
								 xmlSecTransformMode mode,
								 xmlSecTransformCtxPtr transformCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

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

  args = Py_BuildValue((char *) "OiO", wrap_xmlSecTransformPtr(transform),
		       mode, wrap_xmlSecTransformCtxPtr(transformCtx));

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

  return (PyInt_AsLong(result));
}
Ejemplo n.º 5
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.º 6
0
static int xmlsec_TransformVerifyMethod(xmlSecTransformPtr transform,
					const xmlSecByte *data,
					xmlSecSize dataSize,
					xmlSecTransformCtxPtr transformCtx) {
  PyObject *args, *result;
  PyObject *func = NULL;

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

  args = Py_BuildValue((char *) "OsiO", wrap_xmlSecTransformPtr(transform),
		       data, dataSize,
		       wrap_xmlSecTransformCtxPtr(transformCtx));

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

  return (PyInt_AsLong(result));
}
Ejemplo n.º 7
0
PyObject *xmlSecDSigReferenceCtx_getattr(PyObject *self, PyObject *args) {
  PyObject *dsigRefCtx_obj;
  xmlSecDSigReferenceCtxPtr dsigRefCtx;
  const char *attr;

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

  dsigRefCtx = xmlSecDSigReferenceCtxPtr_get(dsigRefCtx_obj);

  if (!strcmp(attr, "__members__"))
    return Py_BuildValue("[ssssssssss]", "dsigCtx",
			 "origin", "transformCtx", "digestMethod",
			 "result", "status", "preDigestMemBufMethod",
			 "id", "uri", "type");
  if (!strcmp(attr, "dsigCtx"))
    return (wrap_xmlSecDSigCtxPtr(dsigRefCtx->dsigCtx));
  if (!strcmp(attr, "origin")) return (wrap_int(dsigRefCtx->origin));
  if (!strcmp(attr, "transformCtx"))
    return (wrap_xmlSecTransformCtxPtr(&(dsigRefCtx->transformCtx)));
  if (!strcmp(attr, "digestMethod"))
    return (wrap_xmlSecTransformPtr(dsigRefCtx->digestMethod));
  if (!strcmp(attr, "result")) return (wrap_xmlSecBufferPtr(dsigRefCtx->result));
  if (!strcmp(attr, "status")) return (wrap_int((dsigRefCtx->status)));
  if (!strcmp(attr, "preDigestMemBufMethod"))
    return (wrap_xmlSecTransformPtr((dsigRefCtx->preDigestMemBufMethod)));
  if (!strcmp(attr, "id")) return (wrap_xmlCharPtr((dsigRefCtx->id)));
  if (!strcmp(attr, "uri")) return (wrap_xmlCharPtr((dsigRefCtx->uri)));
  if (!strcmp(attr, "type")) return (wrap_xmlCharPtr((dsigRefCtx->type)));
  Py_INCREF(Py_None);
  return (Py_None);
}
Ejemplo n.º 8
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.º 9
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);
}