Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 我可以在IronPython中加载同一DLL的两个版本吗_.net_Dll_Clr_Ironpython - Fatal编程技术网

.net 我可以在IronPython中加载同一DLL的两个版本吗

.net 我可以在IronPython中加载同一DLL的两个版本吗,.net,dll,clr,ironpython,.net,Dll,Clr,Ironpython,我有一个DLL,它同时进行加密和解密,但在客户端站点,当一个字符串被加密,然后被发送到另一台机器,通过Web服务进行解密时,解密失败 目前我已经测试了目标机器上的DLL可以很好地加密和解密字符串。我想做的是从两台不同版本的机器上获取DLL,将它们加载到IronPython脚本中,让一个DLL加密,另一个DLL解密。我知道我可以将它们都加载到clr.reference中,因为它们的版本不同,但是在这之后我如何区分它们呢 下面是我现在使用的单个DLL: from Some.Dll import Se

我有一个DLL,它同时进行加密和解密,但在客户端站点,当一个字符串被加密,然后被发送到另一台机器,通过Web服务进行解密时,解密失败

目前我已经测试了目标机器上的DLL可以很好地加密和解密字符串。我想做的是从两台不同版本的机器上获取DLL,将它们加载到IronPython脚本中,让一个DLL加密,另一个DLL解密。我知道我可以将它们都加载到clr.reference中,因为它们的版本不同,但是在这之后我如何区分它们呢

下面是我现在使用的单个DLL:

from Some.Dll import SecurityUtils
from System.Text.Encoding import UTF8

import clr


class Codec:
def __init__(self, publicKey):
    self.decryptedBytes = None
    self.encryptedString = None
    self.publicKey = publicKey

def encrypt(self, text):
    #dir = os.path.dirname(__file__);
    #dir = os.path.join(dir, '..');
    #dir = os.path.join(dir, 'oldsystem');

    #dir = sys.path.append(dir)
    #clr.AddReference(r'Some.Dll')

    textBytes = UTF8.GetBytes(text)
    self.encryptedString = SecurityUtils.Encrypt_RSA(textBytes, self.publicKey)

def decrypt(self):
    self.decryptedBytes = SecurityUtils.Decrypt_RSA(self.encryptedString)

def getDecryptedString(self):
    return UTF8.GetString(self.decryptedBytes)