Example #1
0
 public override void GenerateClientKeyExchange(Stream output)
 {
     if (mAgreementCredentials == null)
     {
         mDHAgreePrivateKey = TlsDHUtilities.GenerateEphemeralClientKeyExchange(mContext.SecureRandom, mDHParameters, output);
     }
 }
 public override void GenerateClientKeyExchange(Stream output)
 {
     if (mPskIdentityHint == null)
     {
         mPskIdentity.SkipIdentityHint();
     }
     else
     {
         mPskIdentity.NotifyIdentityHint(mPskIdentityHint);
     }
     byte[] pskIdentity = mPskIdentity.GetPskIdentity();
     if (pskIdentity == null)
     {
         throw new TlsFatalAlert(80);
     }
     mPsk = mPskIdentity.GetPsk();
     if (mPsk == null)
     {
         throw new TlsFatalAlert(80);
     }
     TlsUtilities.WriteOpaque16(pskIdentity, output);
     mContext.SecurityParameters.pskIdentity = pskIdentity;
     if (mKeyExchange == 14)
     {
         mDHAgreePrivateKey = TlsDHUtilities.GenerateEphemeralClientKeyExchange(mContext.SecureRandom, mDHParameters, output);
     }
     else if (mKeyExchange == 24)
     {
         mECAgreePrivateKey = TlsEccUtilities.GenerateEphemeralClientKeyExchange(mContext.SecureRandom, mServerECPointFormats, mECAgreePublicKey.Parameters, output);
     }
     else if (mKeyExchange == 15)
     {
         mPremasterSecret = TlsRsaUtilities.GenerateEncryptedPreMasterSecret(mContext, mRsaServerPublicKey, output);
     }
 }