public frmMain()
        {
            InitializeComponent();

            secure = new SecurePHPConnection();
            secure.OnConnectionEstablished += new SecurePHPConnection.ConnectionEstablishedHandler(secure_OnConnectionEstablished);
            secure.OnResponseReceived += new SecurePHPConnection.ResponseReceivedHandler(secure_OnResponseReceived);

            // For the second test we are just going to test RSA by hard coding in the key on both the client and server sides
            rsa = new RSAtoPHPCryptography();
            rsa.LoadCertificateFromString("-----BEGIN CERTIFICATE-----MIID2jCCA0OgAwIBAgIJAPEru6Ch9es0MA0GCSqGSIb3DQEBBQUAMIGlMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHRmxvcmlkYTESMBAGA1UEBxMJUGVuc2Fjb2xhMRswGQYDVQQKExJTY290dCBUZXN0IENvbXBhbnkxGTAXBgNVBAsTEFNlY3VyaXR5IFNlY3Rpb24xFjAUBgNVBAMTDVNjb3R0IENsYXl0b24xIDAeBgkqhkiG9w0BCQEWEXNzbEBzcGFya2hpdHouY29tMB4XDTExMDcwNDEzMDczM1oXDTIxMDcwMTEzMDczNFowgaUxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdGbG9yaWRhMRIwEAYDVQQHEwlQZW5zYWNvbGExGzAZBgNVBAoTElNjb3R0IFRlc3QgQ29tcGFueTEZMBcGA1UECxMQU2VjdXJpdHkgU2VjdGlvbjEWMBQGA1UEAxMNU2NvdHQgQ2xheXRvbjEgMB4GCSqGSIb3DQEJARYRc3NsQHNwYXJraGl0ei5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKLEwtnhSD3sUMidycowAhupy59PMh8FYX6ebKy4NYqEiFONzrujkGtAZgmUaCAQBEmGcfBUDVd4ew72Xjikq0WhBUju+wmrIcgnQcIMAXMkZ2gBV12SkvCzRrJf5zqO0rC0x/tBli/46KGrzyYLl7K3QFx3MQPNvVO+w/b0coatAgMBAAGjggEOMIIBCjAdBgNVHQ4EFgQU+6E6OauoEUohJOAgC8OXU3xaHn4wgdoGA1UdIwSB0jCBz4AU+6E6OauoEUohJOAgC8OXU3xaHn6hgaukgagwgaUxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdGbG9yaWRhMRIwEAYDVQQHEwlQZW5zYWNvbGExGzAZBgNVBAoTElNjb3R0IFRlc3QgQ29tcGFueTEZMBcGA1UECxMQU2VjdXJpdHkgU2VjdGlvbjEWMBQGA1UEAxMNU2NvdHQgQ2xheXRvbjEgMB4GCSqGSIb3DQEJARYRc3NsQHNwYXJraGl0ei5jb22CCQDxK7ugofXrNDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAJ8lRVFiLgfxiHsrPvhY+i05FYnDskit9QTnBv2ScM7rfK+EKfOswjxv9sGdGqKaTYE684XCmrwxCx42hNOSgMGDiZAlNoBJdJbF/bw2Qr5HUmZ8G3L3UlB1+qyM0+JkXMqkVcoIR7Ia5AGZHe9/QAwD3nA9rf3diH2LWATtgWNB-----END CERTIFICATE-----");

            http = new AsyncHttpControl();
            http.OnHttpResponse += new AsyncHttpControl.ResponseCallback(http_OnHttpResponse);

            http2 = new AsyncHttpControl();
            http2.OnHttpResponse += new AsyncHttpControl.ResponseCallback(http2_OnHttpResponse);

            // A simple AES test that decrypts a message with a base64 encoded 256 bit key and IV
            AEStoPHPCryptography aes = new AEStoPHPCryptography("YWJjZGVmZ2hpamtsbW5vcGFiY2RlZmdoaWprbG1ub3A=", "YWJjZGVmZ2hpamtsbW5vcA==");
            txtMessage2.Text = aes.Decrypt("34sFYu82zUy4Yrp22lmYN2rlLU1SmwTySx2QhjFGboc=");
        }
Beispiel #2
0
        public frmMain()
        {
            InitializeComponent();

            secure = new SecurePHPConnection();
            secure.OnConnectionEstablished += new SecurePHPConnection.ConnectionEstablishedHandler(secure_OnConnectionEstablished);
            secure.OnResponseReceived      += new SecurePHPConnection.ResponseReceivedHandler(secure_OnResponseReceived);

            // For the second test we are just going to test RSA by hard coding in the key on both the client and server sides
            rsa = new RSAtoPHPCryptography();
            rsa.LoadCertificateFromString("-----BEGIN CERT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YRc3NsQHNwYXJraGl0ei5jb22CCQDxK7ugofXrNDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAJ8lRVFiLgfxiHsrPvhY+i05FYnDskit9QTnBv2ScM7rfK+EKfOswjxv9sGdGqKaTYE684XCmrwxCx42hNOSgMGDiZAlNoBJdJbF/bw2Qr5HUmZ8G3L3UlB1+qyM0+JkXMqkVcoIR7Ia5AGZHe9/QAwD3nA9rf3diH2LWATtgWNB-----END CERTIFICATE-----");

            http = new AsyncHttpControl();
            http.OnHttpResponse += new AsyncHttpControl.ResponseCallback(http_OnHttpResponse);

            http2 = new AsyncHttpControl();
            http2.OnHttpResponse += new AsyncHttpControl.ResponseCallback(http2_OnHttpResponse);

            // A simple AES test that decrypts a message with a base64 encoded 256 bit key and IV
            AEStoPHPCryptography aes = new AEStoPHPCryptography("YWJjZGVmZ2hpamtsbW5vcGFiY2RlZmdoaWprbG1ub3A=", "YWJjZGVmZ2hpamtsbW5vcA==");

            txtMessage2.Text = aes.Decrypt("34sFYu82zUy4Yrp22lmYN2rlLU1SmwTySx2QhjFGboc=");
        }