static void Main2(string message) { RSAEncoder rsaEncoder = new RSAEncoder(); rsaEncoder.InitializeKey(RSA.Create()); Console.WriteLine("Encoding the following message:"); Console.WriteLine(message); byte[] encodedMessage = rsaEncoder.EncodeMessage(message); Console.WriteLine("Resulting message encoded:"); Console.WriteLine(Encoding.ASCII.GetString(encodedMessage)); string decodedMessage = rsaEncoder.DecodeMessage(encodedMessage); Console.WriteLine("Resulting message decoded:"); Console.WriteLine(decodedMessage); // Construct a formatter to demonstrate how to set each property. rsaEncoder.ConstructFormatter(); // Construct a deformatter to demonstrate how to set each property. rsaEncoder.ConstructDeformatter(); Console.WriteLine("This sample completed successfully; " + "press Enter to exit."); Console.ReadLine(); }
private void Form1_Load(object sender, EventArgs e) { InitialiseLogger(); System.Diagnostics.Debug.WriteLine("OpenSoftSled (http://www.codeplex.com/softsled"); // For now we are passing the instance of the logger. Maybe we should place the logger into a global static class in the future? m_device = new ExtenderDevice(m_logger); #region Old //device = UPnPDevice.CreateRootDevice(1801, 1.0, "\\XD\\DeviceDescription.xml"); //device.FriendlyName = "SoftSled Media Center Extender"; //device.Manufacturer = "SoftSled Project"; //device.ManufacturerURL = "http://softsled.net"; //device.ModelName = "SoftSled Extender"; //device.ModelURL = new Uri("http://softsled.net"); //device.ModelDescription = "SoftSled Extender Software"; //device.DeviceURN = "urn:schemas-microsoft-com:device:MediaCenterExtenderMFD:1"; //device.HasPresentation = false; //device.LocationURL = "/XD/DeviceDescription.xml"; //device.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //UPnPDevice subDevice1 = UPnPDevice.CreateEmbeddedDevice(1.0, "840a20cc-a078-4d53-ac54-56f4972851e5"); //subDevice1.DeviceURN = "urn:schemas-microsoft-com:device:MediaCenterExtender:1"; //subDevice1.FriendlyName = "SoftSled Media Center Extender"; //subDevice1.Manufacturer = "SoftSled Project"; //subDevice1.ModelName = "SoftSled Extender"; //subDevice1.ModelURL = new Uri("http://softsled.net"); //subDevice1.ModelDescription = "SoftSled Extender Software"; //subDevice1.AddCustomFieldInDescription("X_compatibleId", "MICROSOFT_MCX_0001", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //subDevice1.AddCustomFieldInDescription("X_deviceCategory", "MediaDevices", "http://schemas.microsoft.com/windows/pnpx/2005/11"); //subDevice1.AddService(new TrustAgreementService()); //UTF8Encoding utf = new UTF8Encoding(); //textBox1.Text = utf.GetString(subDevice1.Services[0].GetSCPDXml()); //device.AddDevice(subDevice1); //device.AddService(new NullService()); //subDevice1.Services[0].OnUPnPEvent += new UPnPService.UPnPEventHandler(Form1_OnUPnPEvent); //deviceWatcher = new UPnPDeviceWatcher(device); //deviceWatcher.OnSniff += new UPnPDeviceWatcher.SniffHandler(deviceWatcher_OnSniff); //deviceWatcher.OnSniffPacket += new UPnPDeviceWatcher.SniffPacketHandler(deviceWatcher_OnSniffPacket); #endregion m_rsaEncoder = new RSAEncoder(); m_rsaEncoder.InitializeKey(RSA.Create()); }