⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 python.c

📁 cryptlib安全工具包
💻 C
📖 第 1 页 / 共 5 页
字号:
	int cryptContext = 0;	int keyset = 0;	int keyIDtype = 0;	PyObject* keyID = NULL;	PyObject* password = NULL;	unsigned char* keyIDPtr = 0;	unsigned char* passwordPtr = 0;		if (!PyArg_ParseTuple(args, "iiOO", &keyset, &keyIDtype, &keyID, &password))	    return(NULL);		if (!getPointerReadString(keyID, &keyIDPtr))		goto finish;	if (!getPointerReadString(password, &passwordPtr))		goto finish;		status = cryptGetKey(keyset, &cryptContext, keyIDtype, keyIDPtr, passwordPtr);		finish:	releasePointerString(keyID, keyIDPtr);	releasePointerString(password, passwordPtr);	return(processStatusReturnCryptHandle(status, cryptContext));}static PyObject* python_cryptAddPublicKey(PyObject* self, PyObject* args){	int status = 0;	int keyset = 0;	int certificate = 0;		if (!PyArg_ParseTuple(args, "ii", &keyset, &certificate))	    return(NULL);		status = cryptAddPublicKey(keyset, certificate);		return(processStatus(status));}static PyObject* python_cryptAddPrivateKey(PyObject* self, PyObject* args){	int status = 0;	int keyset = 0;	int cryptKey = 0;	PyObject* password = NULL;	unsigned char* passwordPtr = 0;		if (!PyArg_ParseTuple(args, "iiO", &keyset, &cryptKey, &password))	    return(NULL);		if (!getPointerReadString(password, &passwordPtr))		goto finish;		status = cryptAddPrivateKey(keyset, cryptKey, passwordPtr);		finish:	releasePointerString(password, passwordPtr);	return(processStatus(status));}static PyObject* python_cryptDeleteKey(PyObject* self, PyObject* args){	int status = 0;	int keyset = 0;	int keyIDtype = 0;	PyObject* keyID = NULL;	unsigned char* keyIDPtr = 0;		if (!PyArg_ParseTuple(args, "iiO", &keyset, &keyIDtype, &keyID))	    return(NULL);		if (!getPointerReadString(keyID, &keyIDPtr))		goto finish;		status = cryptDeleteKey(keyset, keyIDtype, keyIDPtr);		finish:	releasePointerString(keyID, keyIDPtr);	return(processStatus(status));}static PyObject* python_cryptCreateCert(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	int cryptUser = 0;	int certType = 0;		if (!PyArg_ParseTuple(args, "ii", &cryptUser, &certType))	    return(NULL);		status = cryptCreateCert(&certificate, cryptUser, certType);		return(processStatusReturnCryptHandle(status, certificate));}static PyObject* python_cryptDestroyCert(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;		if (!PyArg_ParseTuple(args, "i", &certificate))	    return(NULL);		status = cryptDestroyCert(certificate);		return(processStatus(status));}static PyObject* python_cryptGetCertExtension(PyObject* self, PyObject* args){	int status = 0;	int extensionLength = 0;	int criticalFlag = 0;	int certificate = 0;	PyObject* oid = NULL;	PyObject* extension = NULL;	int extensionMaxLength = 0;	unsigned char* oidPtr = 0;	unsigned char* extensionPtr = 0;		if (!PyArg_ParseTuple(args, "iOOi", &certificate, &oid, &extension, &extensionMaxLength))	    return(NULL);		if (!getPointerReadString(oid, &oidPtr))		goto finish;		if (!processStatusBool(cryptGetCertExtension(certificate, oidPtr, &criticalFlag, NULL, extensionMaxLength, &extensionLength)))		goto finish;		if (!getPointerWriteCheckIndices(extension, &extensionPtr, &extensionLength))		goto finish;		status = cryptGetCertExtension(certificate, oidPtr, &criticalFlag, extensionPtr, extensionMaxLength, &extensionLength);		finish:	releasePointer(extension, extensionPtr);	releasePointerString(oid, oidPtr);	return(processStatusReturnInt(status, extensionLength));}static PyObject* python_cryptAddCertExtension(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	PyObject* oid = NULL;	int criticalFlag = 0;	PyObject* extension = NULL;	int extensionLength = 0;	unsigned char* oidPtr = 0;	unsigned char* extensionPtr = 0;		if (!PyArg_ParseTuple(args, "iOiO", &certificate, &oid, &criticalFlag, &extension))	    return(NULL);		if (!getPointerReadString(oid, &oidPtr))		goto finish;		if (!getPointerRead(extension, &extensionPtr, &extensionLength))		goto finish;		status = cryptAddCertExtension(certificate, oidPtr, criticalFlag, extensionPtr, extensionLength);		finish:	releasePointer(extension, extensionPtr);	releasePointerString(oid, oidPtr);	return(processStatus(status));}static PyObject* python_cryptDeleteCertExtension(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	PyObject* oid = NULL;	unsigned char* oidPtr = 0;		if (!PyArg_ParseTuple(args, "iO", &certificate, &oid))	    return(NULL);		if (!getPointerReadString(oid, &oidPtr))		goto finish;		status = cryptDeleteCertExtension(certificate, oidPtr);		finish:	releasePointerString(oid, oidPtr);	return(processStatus(status));}static PyObject* python_cryptSignCert(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	int signContext = 0;		if (!PyArg_ParseTuple(args, "ii", &certificate, &signContext))	    return(NULL);		status = cryptSignCert(certificate, signContext);		return(processStatus(status));}static PyObject* python_cryptCheckCert(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	int sigCheckKey = 0;		if (!PyArg_ParseTuple(args, "ii", &certificate, &sigCheckKey))	    return(NULL);		status = cryptCheckCert(certificate, sigCheckKey);		return(processStatus(status));}static PyObject* python_cryptImportCert(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	PyObject* certObject = NULL;	int certObjectLength = 0;	int cryptUser = 0;	unsigned char* certObjectPtr = 0;		if (!PyArg_ParseTuple(args, "Oi", &certObject, &cryptUser))	    return(NULL);		if (!getPointerRead(certObject, &certObjectPtr, &certObjectLength))		goto finish;		status = cryptImportCert(certObjectPtr, certObjectLength, cryptUser, &certificate);		finish:	releasePointer(certObject, certObjectPtr);	return(processStatusReturnCryptHandle(status, certificate));}static PyObject* python_cryptExportCert(PyObject* self, PyObject* args){	int status = 0;	int certObjectLength = 0;	PyObject* certObject = NULL;	int certObjectMaxLength = 0;	int certFormatType = 0;	int certificate = 0;	unsigned char* certObjectPtr = 0;		if (!PyArg_ParseTuple(args, "Oiii", &certObject, &certObjectMaxLength, &certFormatType, &certificate))	    return(NULL);		if (!processStatusBool(cryptExportCert(NULL, certObjectMaxLength, &certObjectLength, certFormatType, certificate)))		goto finish;		if (!getPointerWriteCheckIndices(certObject, &certObjectPtr, &certObjectLength))		goto finish;		status = cryptExportCert(certObjectPtr, certObjectMaxLength, &certObjectLength, certFormatType, certificate);		finish:	releasePointer(certObject, certObjectPtr);	return(processStatusReturnInt(status, certObjectLength));}static PyObject* python_cryptCAAddItem(PyObject* self, PyObject* args){	int status = 0;	int keyset = 0;	int certificate = 0;		if (!PyArg_ParseTuple(args, "ii", &keyset, &certificate))	    return(NULL);		status = cryptCAAddItem(keyset, certificate);		return(processStatus(status));}static PyObject* python_cryptCAGetItem(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	int keyset = 0;	int certType = 0;	int keyIDtype = 0;	PyObject* keyID = NULL;	unsigned char* keyIDPtr = 0;		if (!PyArg_ParseTuple(args, "iiiO", &keyset, &certType, &keyIDtype, &keyID))	    return(NULL);		if (!getPointerReadString(keyID, &keyIDPtr))		goto finish;		status = cryptCAGetItem(keyset, &certificate, certType, keyIDtype, keyIDPtr);		finish:	releasePointerString(keyID, keyIDPtr);	return(processStatusReturnCryptHandle(status, certificate));}static PyObject* python_cryptCADeleteItem(PyObject* self, PyObject* args){	int status = 0;	int keyset = 0;	int certType = 0;	int keyIDtype = 0;	PyObject* keyID = NULL;	unsigned char* keyIDPtr = 0;		if (!PyArg_ParseTuple(args, "iiiO", &keyset, &certType, &keyIDtype, &keyID))	    return(NULL);		if (!getPointerReadString(keyID, &keyIDPtr))		goto finish;		status = cryptCADeleteItem(keyset, certType, keyIDtype, keyIDPtr);		finish:	releasePointerString(keyID, keyIDPtr);	return(processStatus(status));}static PyObject* python_cryptCACertManagement(PyObject* self, PyObject* args){	int status = 0;	int certificate = 0;	int action = 0;	int keyset = 0;	int caKey = 0;	int certRequest = 0;		if (!PyArg_ParseTuple(args, "iiii", &action, &keyset, &caKey, &certRequest))	    return(NULL);		status = cryptCACertManagement(&certificate, action, keyset, caKey, certRequest);		return(processStatusReturnCryptHandle(status, certificate));}static PyObject* python_cryptCreateEnvelope(PyObject* self, PyObject* args){	int status = 0;	int envelope = 0;	int cryptUser = 0;	int formatType = 0;		if (!PyArg_ParseTuple(args, "ii", &cryptUser, &formatType))	    return(NULL);		status = cryptCreateEnvelope(&envelope, cryptUser, formatType);		return(processStatusReturnCryptHandle(status, envelope));}static PyObject* python_cryptDestroyEnvelope(PyObject* self, PyObject* args){	int status = 0;	int envelope = 0;		if (!PyArg_ParseTuple(args, "i", &envelope))	    return(NULL);		status = cryptDestroyEnvelope(envelope);		return(processStatus(status));}static PyObject* python_cryptCreateSession(PyObject* self, PyObject* args){	int status = 0;	int session = 0;	int cryptUser = 0;	int formatType = 0;		if (!PyArg_ParseTuple(args, "ii", &cryptUser, &formatType))	    return(NULL);		status = cryptCreateSession(&session, cryptUser, formatType);		return(processStatusReturnCryptHandle(status, session));}static PyObject* python_cryptDestroySession(PyObject* self, PyObject* args){	int status = 0;	int session = 0;		if (!PyArg_ParseTuple(args, "i", &session))	    return(NULL);		status = cryptDestroySession(session);		return(processStatus(status));}static PyObject* python_cryptPushData(PyObject* self, PyObject* args){	int status = 0;	int bytesCopied = 0;	int envelope = 0;	PyObject* buffer = NULL;	int length = 0;	unsigned char* bufferPtr = 0;		if (!PyArg_ParseTuple(args, "iO", &envelope, &buffer))	    return(NULL);		if (!getPointerRead(buffer, &bufferPtr, &length))		goto finish;		status = cryptPushData(envelope, bufferPtr, length, &bytesCopied);		finish:	releasePointer(buffer, bufferPtr);	return(processStatusReturnInt(status, bytesCopied));}static PyObject* python_cryptFlushData(PyObject* self, PyObject* args){	int status = 0;	int envelope = 0;		if (!PyArg_ParseTuple(args, "i", &envelope))	    return(NULL);		status = cryptFlushData(envelope);	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -