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 *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 #3
0
PyObject *xmlsec_KeyDataBinWrite(PyObject *self, PyObject *args) {
  PyObject *id_obj, *key_obj, *keyInfoCtx_obj;
  xmlSecKeyDataId id;
  xmlSecKeyPtr key;
  // FIXME
  //xmlSecByte **buf;
  //xmlSecSize *bufSize;
  xmlSecByte *buf;
  xmlSecSize bufSize;
  xmlSecKeyInfoCtxPtr keyInfoCtx;

  if (CheckArgs(args, "OOSIO:keyDataBinWrite")) {
    if (!PyArg_ParseTuple(args, "OOsiO:keyDataBinWrite",
			  &id_obj, &key_obj, &buf, &bufSize, &keyInfoCtx_obj))
    return NULL;
  }
  else return NULL;

  id = xmlSecKeyDataId_get(id_obj);
  key = xmlSecKeyPtr_get(key_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  //return (wrap_int(xmlSecKeyDataBinWrite(id, key, buf, bufSize, keyInfoCtx)));
  return (wrap_int(xmlSecKeyDataBinWrite(id, key, &buf, &bufSize, keyInfoCtx)));
}
Exemple #4
0
PyObject *xmlsec_KeyInfoCtxCopyUserPref(PyObject *self, PyObject *args) {
  PyObject *dst_obj, *src_obj;
  xmlSecKeyInfoCtxPtr dst;
  xmlSecKeyInfoCtxPtr src;

  if (CheckArgs(args, "OO:keyInfoCtxCopyUserPref")) {
    if (!PyArg_ParseTuple(args, "OO:keyInfoCtxCopyUserPref",
			  &dst_obj, &src_obj))
      return NULL;
  }
  else return NULL;

  dst = xmlSecKeyInfoCtxPtr_get(dst_obj);
  src = xmlSecKeyInfoCtxPtr_get(src_obj);

  return (wrap_int(xmlSecKeyInfoCtxCopyUserPref(dst, src)));
}
Exemple #5
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);
}
Exemple #6
0
PyObject *xmlsec_KeyInfoCtxCreateEncCtx(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;

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

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  return (wrap_int(xmlSecKeyInfoCtxCreateEncCtx(keyInfoCtx)));
}
Exemple #7
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);
}
Exemple #8
0
PyObject *xmlsec_KeyInfoCtxReset(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;

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

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  xmlSecKeyInfoCtxReset(keyInfoCtx);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #9
0
PyObject *xmlsec_KeyInfoCtxInitialize(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj, *mngr_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  xmlSecKeysMngrPtr mngr = NULL;

  if (CheckArgs(args, "Oo:keyInfoCtxInitialize")) {
    if (!PyArg_ParseTuple(args, "OO:keyInfoCtxInitialize", &keyInfoCtx_obj,
			  &mngr_obj))
      return NULL;
  }
  else return NULL;

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  /* mngr may be NULL */
  mngr = xmlSecKeysMngrPtr_get(mngr_obj);
  
  return (wrap_int(xmlSecKeyInfoCtxInitialize(keyInfoCtx, mngr)));
}
Exemple #10
0
PyObject *xmlsec_KeyInfoCtxDebugXmlDump(PyObject *self, PyObject *args) {
  PyObject *keyInfoCtx_obj, *output_obj;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  FILE *output;

  if (CheckArgs(args, "OF:keyInfoCtxDebugXmlDump")) {
    if (!PyArg_ParseTuple(args, "OO:keyInfoCtxDebugXmlDump",
			  &keyInfoCtx_obj, &output_obj))
      return NULL;
  }
  else return NULL;

  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  output = PythonFile_get(output_obj);
  xmlSecKeyInfoCtxDebugXmlDump(keyInfoCtx, output);

  Py_INCREF(Py_None);
  return (Py_None);
}
Exemple #11
0
PyObject *xmlsec_KeyInfoNodeWrite(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj, *key_obj, *keyInfoCtx_obj;
  xmlNodePtr keyInfoNode;
  xmlSecKeyPtr key;
  xmlSecKeyInfoCtxPtr keyInfoCtx;

  if (CheckArgs(args, "OOO:keyInfoNodeWrite")) {
    if (!PyArg_ParseTuple(args, "OOO:keyInfoNodeWrite",
			  &keyInfoNode_obj, &key_obj, &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;

  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  key = xmlSecKeyPtr_get(key_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  return (wrap_int(xmlSecKeyInfoNodeWrite(keyInfoNode, key, keyInfoCtx)));
}
Exemple #12
0
PyObject *xmlsec_X509DataGetNodeContent(PyObject *self, PyObject *args) {
  PyObject *node_obj, *keyInfoCtx_obj;
  xmlNodePtr node;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  int ret;

  if (CheckArgs(args, "OIO:x509DataGetNodeContent")) {
    if (!PyArg_ParseTuple(args, "OiO:x509DataGetNodeContent", &node_obj,
			  &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;

  node = xmlNodePtr_get(node_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  ret = xmlSecX509DataGetNodeContent(node, keyInfoCtx);

  return wrap_int(ret);
}
Exemple #13
0
PyObject *xmlsec_KeyStoreFindKey(PyObject *self, PyObject *args) {
  PyObject *store_obj, *keyInfoCtx_obj;
  const xmlChar *name;
  xmlSecKeyStorePtr store;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  xmlSecKeyPtr key;

  if (CheckArgs(args, "OSO:keyStoreFindKey")) {
    if (!PyArg_ParseTuple(args, "OsO:keyStoreFindKey", &store_obj, &name,
			  &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;
 
  store = xmlSecKeyStorePtr_get(store_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  key = xmlSecKeyStoreFindKey(store, name, keyInfoCtx);

  return (wrap_xmlSecKeyPtr(key));
}
Exemple #14
0
PyObject *xmlsec_KeysMngrGetKey(PyObject *self, PyObject *args) {
  PyObject *keyInfoNode_obj, *keyInfoCtx_obj;
  xmlNodePtr keyInfoNode;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  xmlSecKeyPtr key;

  if (CheckArgs(args, "OO:keysMngrGetKey")) {
    if (!PyArg_ParseTuple(args, "OO:keysMngrGetKey",
			  &keyInfoNode_obj, &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;

  keyInfoNode = xmlNodePtr_get(keyInfoNode_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  key = xmlSecKeysMngrGetKey(keyInfoNode, keyInfoCtx);

  return (wrap_xmlSecKeyPtr(key));
}
Exemple #15
0
PyObject *xmlsec_KeysMngrFindKey(PyObject *self, PyObject *args) {
  PyObject *mngr_obj, *keyInfoCtx_obj;
  const xmlChar *name;
  xmlSecKeysMngrPtr mngr;
  xmlSecKeyInfoCtxPtr keyInfoCtx;
  xmlSecKeyPtr key;

  if (CheckArgs(args, "OSO:keysMngrFindKey")) {
    if (!PyArg_ParseTuple(args, "OsO:keysMngrFindKey",
			  &mngr_obj, &name, &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;
 
  mngr = xmlSecKeysMngrPtr_get(mngr_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);
  key = xmlSecKeysMngrFindKey(mngr, name, keyInfoCtx);

  return (wrap_xmlSecKeyPtr(key));
}
Exemple #16
0
PyObject *xmlsec_KeyDataXmlWrite(PyObject *self, PyObject *args) {
  PyObject *id_obj, *key_obj, *node_obj, *keyInfoCtx_obj;
  xmlSecKeyDataId id;
  xmlSecKeyPtr key;
  xmlNodePtr node;
  xmlSecKeyInfoCtxPtr keyInfoCtx;

  if (CheckArgs(args, "OOOO:keyDataXmlWrite")) {
    if (!PyArg_ParseTuple(args, "OOOO:keyDataXmlWrite",
			  &id_obj, &key_obj, &node_obj, &keyInfoCtx_obj))
      return NULL;
  }
  else return NULL;

  id = xmlSecKeyDataId_get(id_obj);
  key = xmlSecKeyPtr_get(key_obj);
  node = xmlNodePtr_get(node_obj);
  keyInfoCtx = xmlSecKeyInfoCtxPtr_get(keyInfoCtx_obj);

  return (wrap_int(xmlSecKeyDataXmlWrite(id, key, node, keyInfoCtx)));
}