Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ProtectedData DataProtectionScope
Message
De
01/05/2007 11:26:11
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Cryptographie
Titre:
ProtectedData DataProtectionScope
Divers
Thread ID:
01221511
Message ID:
01221511
Vues:
475
I am using VS2005. I am trying to use the DPAPI through the ProtectedData Class to encypt passwords.

However, when I try the below example, I always get errors on the ProtectedData and DataProtectionScope. The error messages are:
The name 'ProtectedData' does not exist in the current context
The name 'DataProtectionScope' does not exist in the current context

What can I do to get this to work?
using System.Security.Cryptography;

class Program
{
static void Main(string[] args)
{
String plainText = "mypassword";
String entropyText = "mykey";
byte[] plainBytes = Encoding.Unicode.GetBytes(plainText);
byte[] entropyBytes = Encoding.Unicode.GetBytes(entropyText);

//Errors occur here.
byte[] encryptedBytes = ProtectedData.Protect(plainBytes, entropyBytes, DataProtectionScope.CurrentUser);
}
}
Thanks,

Jerry
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform