在C+中是否有C#SecureString等价物+;?

在C+中是否有C#SecureString等价物+;?,c#,c++,securestring,C#,C++,Securestring,我的C#代码中有一个SecureString,需要将其传递到DLL中。我更愿意不进行编组,因为当出现这种情况时,SecureString似乎是未加密的(因此不再安全)。所以问题是C++中是否存在C?ScReSouthStand等价物,这样我就可以将CuxII代码中的ScReScript传递到C++ DLL中…或者如果有一个更好的/不同的方式,这样我就不需要对SeCube字符串进行加密,将它传递给DLL。< P>假设C++编译器以公共语言运行时(CLR)为目标,可以使用同一个 ScReScult<

我的C#代码中有一个SecureString,需要将其传递到DLL中。我更愿意不进行编组,因为当出现这种情况时,SecureString似乎是未加密的(因此不再安全)。所以问题是C++中是否存在C?ScReSouthStand等价物,这样我就可以将CuxII代码中的ScReScript传递到C++ DLL中…或者如果有一个更好的/不同的方式,这样我就不需要对SeCube字符串进行加密,将它传递给DLL。

< P>假设C++编译器以公共语言运行时(CLR)为目标,可以使用同一个<代码> ScReScult< /Cuff>实现。
using namespace System;
using namespace System::Security;

int main(array<System::String ^> ^args)
{
   // Define the string value to assign to a new secure string.
   Char chars[4] = { 't', 'e', 's', 't' };
   // Instantiate the secure string.
   SecureString^ testString = gcnew SecureString();
   // Assign the character array to the secure string.
   for each (Char ch in chars)
   {
      testString->AppendChar(ch);
   }   
   // Display secure string length.
   Console::WriteLine("The length of the string is {0} characters.", 
                        testString->Length);

   delete testString;
   return 0;
}
// The example displays the following output:
//      The length of the string is 4 characters 4 characters
使用名称空间系统;
使用名称空间系统::安全性;
int main(数组^args)
{
//定义要分配给新安全字符串的字符串值。
Char chars[4]={'t','e','s','t'};
//实例化安全字符串。
SecureString^testString=gcnew SecureString();
//将字符数组指定给安全字符串。
每一个字符(以字符为单位)
{
testString->AppendChar(ch);
}   
//显示安全字符串长度。
Console::WriteLine(“字符串的长度为{0}个字符。”,
测试字符串->长度);
删除测试字符串;
返回0;
}
//该示例显示以下输出:
//字符串的长度为4个字符4个字符

<代码> > p>假设C++编译器以公共语言运行库(CLR)为目标,可以使用相同的<代码> ScReScult实现。
using namespace System;
using namespace System::Security;

int main(array<System::String ^> ^args)
{
   // Define the string value to assign to a new secure string.
   Char chars[4] = { 't', 'e', 's', 't' };
   // Instantiate the secure string.
   SecureString^ testString = gcnew SecureString();
   // Assign the character array to the secure string.
   for each (Char ch in chars)
   {
      testString->AppendChar(ch);
   }   
   // Display secure string length.
   Console::WriteLine("The length of the string is {0} characters.", 
                        testString->Length);

   delete testString;
   return 0;
}
// The example displays the following output:
//      The length of the string is 4 characters 4 characters
使用名称空间系统;
使用名称空间系统::安全性;
int main(数组^args)
{
//定义要分配给新安全字符串的字符串值。
Char chars[4]={'t','e','s','t'};
//实例化安全字符串。
SecureString^testString=gcnew SecureString();
//将字符数组指定给安全字符串。
每一个字符(以字符为单位)
{
testString->AppendChar(ch);
}   
//显示安全字符串长度。
Console::WriteLine(“字符串的长度为{0}个字符。”,
测试字符串->长度);
删除测试字符串;
返回0;
}
//该示例显示以下输出:
//字符串的长度为4个字符4个字符

>您只需将其作为纯文本发送,也许可以查看使用保护数据。C++中的Cype和CurnTurnPrutsDebug在C++中的保护,两者都使用DPAPI@Ralf我明确地说我试图避免封送处理。我没有检查,但我的印象是,你得到一个仍然加密的字符串从编组,你可以通过RtlDecryptMemory解密在C++中。但我可能错了。Marshal类的Docu对此并不清楚。至少它没有明确地说明它确实对字符串进行解密。您只能将其作为纯文本发送,或者使用保护数据。C++中的Cype和CurtTurnPrutsDATA中的保护,两者都使用DPAPI@Ralf我明确地说我试图避免封送处理。我没有检查,但我的印象是,你得到一个仍然加密的字符串从编组,你可以通过RtlDecryptMemory解密在C++中。但我可能错了。Marshal类的Docu对此并不清楚。至少它没有显式地指定它对字符串进行解密。