예제 #1
0
            private bool CheckPeerCertSigners(X509Certificate2 remoteCert, X509Chain chain)
            {
                bool signersOk = false;

                try
                {
                    CStoredCertificate.ChainCertificateAndSigners(remoteCert, peerSigners, true);
                    signersOk = true;
                }
                catch (Exception e)
                {
                    signersOk = false;
                }
                return(signersOk);
            }
예제 #2
0
            /// <summary>
            /// Exports the signer certificates to a PEM string. Each certificate is enclosed
            /// inside "-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----"
            /// The first certificate corresponds to the first signer of the primary certificate
            /// and so on until the final certificate is the self-signed root.
            /// </summary>
            /// <returns>The PEM formatted string.</returns>
            public virtual string ExportSignersToPEM()
            {
                StringBuilder pem_strb = new StringBuilder();

                foreach (X509Certificate2 cert in Signers)
                {
                    pem_strb.Append(CStoredCertificate.ExportCertificateToPEM(cert));
                    if (cert != Signers[Signers.Count - 1])
                    {
                        pem_strb.Append("\r\n");
                    }
                }

                return(pem_strb.ToString());
            }