Ejemplo n.º 1
0
            internal unsafe void Set(CertInfoIntenal cii)
            {
                Algorithm = new byte[cii.AlgSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.Algorithm, Algorithm, 0, cii.AlgSize);
                Validity = (cii.Validity != 0);

                sbyte *p = (sbyte *)cii.CertPem.ToPointer();

                CertPem = new string(p);

                p      = (sbyte *)cii.Issuer.ToPointer();
                Issuer = new string(p);

                p        = (sbyte *)cii.NotAfter.ToPointer();
                NotAfter = new string(p);

                p         = (sbyte *)cii.NotBefore.ToPointer();
                NotBefore = new string(p);

                PublicKey = new byte[cii.PKSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.PublicKey, PublicKey, 0, cii.PKSize);

                SerialNumber = new byte[cii.SNSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.SerialNumber, SerialNumber, 0, cii.SNSize);

                p           = (sbyte *)cii.SessionInfo.ToPointer();
                SessionInfo = new string(p);

                p      = (sbyte *)cii.SigAlg.ToPointer();
                SigAlg = new string(p);

                p       = (sbyte *)cii.Subject.ToPointer();
                Subject = new string(p);
            }
Ejemplo n.º 2
0
 static SSL()
 {
     m_cvCallback += (preverified, depth, errCode, errMessage, ptr) =>
     {
         if (CertificateVerify != null && ptr != IntPtr.Zero)
         {
             string errMsg = null;
             CertInfo ci = new CertInfo();
             CertInfoIntenal cii = new CertInfoIntenal();
             System.Runtime.InteropServices.Marshal.PtrToStructure(ptr, cii);
             ci.Set(cii);
             unsafe
             {
                 if (errMessage != IntPtr.Zero)
                     errMsg = new string((sbyte*)errMessage);
             }
             return (byte)(CertificateVerify.Invoke(preverified != 0, depth, errCode, errMsg, ci) ? 1 : 0);
         }
         return 1;
     };
     ClientCoreLoader.SetCertificateVerifyCallback(m_cvCallback);
 }
Ejemplo n.º 3
0
            internal unsafe void Set(CertInfoIntenal cii)
            {
                Algorithm = new byte[cii.AlgSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.Algorithm, Algorithm, 0, cii.AlgSize);
                Validity = (cii.Validity != 0);

                sbyte* p = (sbyte*)cii.CertPem.ToPointer();
                CertPem = new string(p);

                p = (sbyte*)cii.Issuer.ToPointer();
                Issuer = new string(p);

                p = (sbyte*)cii.NotAfter.ToPointer();
                NotAfter = new string(p);

                p = (sbyte*)cii.NotBefore.ToPointer();
                NotBefore = new string(p);

                PublicKey = new byte[cii.PKSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.PublicKey, PublicKey, 0, cii.PKSize);

                SerialNumber = new byte[cii.SNSize];
                System.Runtime.InteropServices.Marshal.Copy(cii.SerialNumber, SerialNumber, 0, cii.SNSize);

                p = (sbyte*)cii.SessionInfo.ToPointer();
                SessionInfo = new string(p);

                p = (sbyte*)cii.SigAlg.ToPointer();
                SigAlg = new string(p);

                p = (sbyte*)cii.Subject.ToPointer();
                Subject = new string(p);
            }
Ejemplo n.º 4
0
 internal CUCertImpl(CClientSocket cs)
 {
     m_cs = cs;
     IntPtr p = ClientCoreLoader.GetUCert(cs.Handle);
     if (p != IntPtr.Zero)
     {
         CertInfoIntenal cii = new CertInfoIntenal();
         System.Runtime.InteropServices.Marshal.PtrToStructure(p, cii);
         Set(cii);
     }
 }