Пример #1
0
        protected virtual AbstractCertificate ParseClientCertificate(Stream stm)
        {
            switch (mCertificateTypeClient)
            {
            case CertificateType.X509:
                return(Certificate.Parse(stm));

            case CertificateType.RawPublicKey:
                return(RawPublicKey.Parse(stm));

            default:
                throw new TlsFatalAlert(AlertDescription.bad_certificate);
            }
        }
Пример #2
0
        protected virtual AbstractCertificate ParseCertificate(ServerHandshakeState state, Stream buf)
        {
            AbstractCertificate cert = state.server.ParseCertificate(state.clientCertificateType, buf);

            if (cert != null)
            {
                return(cert);
            }

            switch (state.clientCertificateType)
            {
            case CertificateType.X509:
                return(Certificate.Parse(buf));

            case CertificateType.RawPublicKey:
                return(RawPublicKey.Parse(buf));

            default:
                throw new TlsFatalAlert(AlertDescription.bad_certificate);
            }
        }