public override void ProcessServerKeyExchange(Stream input)
 {
     mPskIdentityHint = TlsUtilities.ReadOpaque16(input);
     if (mKeyExchange == 14)
     {
         ServerDHParams serverDHParams = ServerDHParams.Parse(input);
         mDHAgreePublicKey = TlsDHUtilities.ValidateDHPublicKey(serverDHParams.PublicKey);
         mDHParameters     = mDHAgreePublicKey.Parameters;
     }
     else if (mKeyExchange == 24)
     {
         ECDomainParameters curve_params = TlsEccUtilities.ReadECParameters(mNamedCurves, mClientECPointFormats, input);
         byte[]             encoding     = TlsUtilities.ReadOpaque8(input);
         mECAgreePublicKey = TlsEccUtilities.ValidateECPublicKey(TlsEccUtilities.DeserializeECPublicKey(mClientECPointFormats, curve_params, encoding));
     }
 }
예제 #2
0
    public override void ProcessServerKeyExchange(Stream input)
    {
        SecurityParameters securityParameters = mContext.SecurityParameters;
        SignerInputBuffer  signerInputBuffer  = new SignerInputBuffer();
        Stream             input2             = new TeeInputStream(input, signerInputBuffer);
        ServerDHParams     serverDHParams     = ServerDHParams.Parse(input2);
        DigitallySigned    digitallySigned    = ParseSignature(input);
        ISigner            signer             = InitVerifyer(mTlsSigner, digitallySigned.Algorithm, securityParameters);

        signerInputBuffer.UpdateSigner(signer);
        if (!signer.VerifySignature(digitallySigned.Signature))
        {
            throw new TlsFatalAlert(51);
        }
        mDHAgreePublicKey = TlsDHUtilities.ValidateDHPublicKey(serverDHParams.PublicKey);
        mDHParameters     = ValidateDHParameters(mDHAgreePublicKey.Parameters);
    }
        public override void ProcessServerKeyExchange(Stream input)
        {
            SecurityParameters securityParameters = mContext.SecurityParameters;

            SignerInputBuffer buf   = new SignerInputBuffer();
            Stream            teeIn = new TeeInputStream(input, buf);

            ServerDHParams dhParams = ServerDHParams.Parse(teeIn);

            DigitallySigned signed_params = ParseSignature(input);

            mSignatureAndHashAlgorithm = signed_params.Algorithm;

            ISigner signer = InitVerifyer(mTlsSigner, signed_params.Algorithm, securityParameters);

            buf.UpdateSigner(signer);
            if (!signer.VerifySignature(signed_params.Signature))
            {
                throw new TlsFatalAlert(AlertDescription.decrypt_error);
            }

            this.mDHAgreePublicKey = TlsDHUtilities.ValidateDHPublicKey(dhParams.PublicKey);
            this.mDHParameters     = ValidateDHParameters(mDHAgreePublicKey.Parameters);
        }