[C# 2.0] Problème de décryptage SecureString
Bonjour, J'essai de décrypter un code crypter avec SecureString.
Voilà comment je fais pour crypter ma chaine :
Code:
1 2 3 4 5 6 7 8 9
|
SecureString sString = new SecureString();
foreach (char unChar in password) {
sString.AppendChar(unChar);
}
sString.Clear();
IntPtr pointer = Marshal.SecureStringToBSTR(sString);
return pointer.ToString(); |
le code est inscrit dans un fichier xml.
Maintenant, prend ce code et je veux le décrypter. Pour l'instant, voilà où j'en suis :
Code:
1 2 3 4 5
|
IntPtr pointer = new IntPtr(password);
String passwordDecrypt = Marshal.PtrToStringUni(pointer);
return passwordDecrypt; |
Le problème c'est que passwordDecrypt est = à vide ou à des caractère bizard... Quelqu'un peut m'aider svp ?
Merci d'avance.