System.Security.Cryptography.ProtectedData System.Security.Cryptography var rawString = "Hello"; var rawBytes = Encoding.UTF8.GetBytes(rawString); var protectedBytes = ProtectedData.Protect(rawBytes, null, DataProtectionScope.CurrentUser); var protectedBase64String = Convert.ToBase64String(protectedBytes); protectedBase64String.Dump();