Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;
- using System.Security;
- using System.IO;
- string exportKeyFile = @"C:keyEngagementProviderExport.txt";
- string exportKeyPw = "p@ssword";
- string saveKeyFile = @"C:keyEngagementProvider.key";
- ProtectedKey NewServerKey;
- using (FileStream fs = File.OpenRead(exportKeyFile))
- {
- NewServerKey = KeyManager.RestoreKey(fs, exportKeyPw, System.Security.Cryptography.DataProtectionScope.LocalMachine);
- }
- using (FileStream ofs = File.OpenWrite(saveKeyFile))
- {
- KeyManager.Write(ofs, NewServerKey);
- }
Add Comment
Please, Sign In to add comment