示例#1
0
        static void StartClient()
        {
            var    client = new TcpClient();
            string clnt2IP;

            Console.WriteLine("Podaj IP adresata certyfikatu: ");
            clnt2IP = Console.ReadLine();
            Console.WriteLine("Klient1: Podaj nr certyfikatu 1-50");
            client.Connect(IPAddress.Parse(clnt2IP), 12341);

            NetworkStream serverStream = client.GetStream();

            var    ApplicationOcspRequest = new OCSPRequest();
            string dane;

            dane = Console.ReadLine();
            ApplicationOcspRequest.CertificateID   = dane;
            ApplicationOcspRequest.OCSPRequestData = "";
            ApplicationOcspRequest.Version         = 1;
            ApplicationOcspRequest.RequestorList   = "";
            ApplicationOcspRequest.HashAlgorithm   = "SHA1";
            ApplicationOcspRequest.IssuerNameHash  = "M7UBSJK9MTNGFIO96QF1GHFA7UCEHJKTG5UYE5XROBY";
            ApplicationOcspRequest.IssuerKeyHash   = "8Z6D03Y285CJOIE97J5V1KXQ47SNECDD29HS35L21NC";
            ApplicationOcspRequest.SerialNumber    = "FIL2YF0HT4KW8CWFVPB7I2KK87RER8GWHRP6XFEHAO3";
            Serializer.SerializeWithLengthPrefix(serverStream, ApplicationOcspRequest, PrefixStyle.Base128);
        }
示例#2
0
        static void Main(string[] args)
        {
            var ApplicationOcspRequest = new OCSPRequest();

            ApplicationOcspRequest = StartAcceptor();
            StartClient(ApplicationOcspRequest);
            var ApplicationOcspResponse = new OCSPResponse();

            ApplicationOcspResponse = StartAcceptor1();
            StartClient1(ApplicationOcspResponse);
            Console.ReadKey();
        }
示例#3
0
        static OCSPRequest StartAcceptor()
        {
            var         ipAddress    = IPAddress.Parse("127.0.0.1");
            TcpListener serverSocket = new TcpListener(ipAddress, 12341);

            serverSocket.Start();
            Console.WriteLine("Klient2: Oczekiwanie...");

            var         clientSocket           = serverSocket.AcceptTcpClient();
            OCSPRequest ApplicationOcspRequest = StartServerSocket(clientSocket);

            serverSocket.Stop();
            return(ApplicationOcspRequest);
        }
示例#4
0
        static void StartClient(OCSPRequest dane)
        {
            var    client = new TcpClient();
            string srvIP;

            Console.WriteLine("Podaj IP serwera: ");
            srvIP = Console.ReadLine();
            client.Connect(IPAddress.Parse(srvIP), 12340);

            NetworkStream serverStream = client.GetStream();

            var ApplicationOcspRequest = new OCSPRequest();

            ApplicationOcspRequest = dane;

            Serializer.SerializeWithLengthPrefix(serverStream, ApplicationOcspRequest, PrefixStyle.Base128);
            Console.WriteLine("Klient2: Przesłano " + ApplicationOcspRequest.CertificateID);
        }