Guest User

Untitled

a guest
Jan 18th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;
  2. using System.Security;
  3. using System.IO;
  4.  
  5. string exportKeyFile = @"C:keyEngagementProviderExport.txt";
  6. string exportKeyPw = "p@ssword";
  7. string saveKeyFile = @"C:keyEngagementProvider.key";
  8. ProtectedKey NewServerKey;
  9.  
  10. using (FileStream fs = File.OpenRead(exportKeyFile))
  11. {
  12. NewServerKey = KeyManager.RestoreKey(fs, exportKeyPw, System.Security.Cryptography.DataProtectionScope.LocalMachine);
  13. }
  14.  
  15. using (FileStream ofs = File.OpenWrite(saveKeyFile))
  16. {
  17. KeyManager.Write(ofs, NewServerKey);
  18. }
Add Comment
Please, Sign In to add comment