Brunet.Security.SecurityAssociationTest.Setup C# (CSharp) Method

Setup() protected method

protected Setup ( SecurityAssociation &sa1, SecurityAssociation &sa2 ) : void
sa1 SecurityAssociation
sa2 SecurityAssociation
return void
    protected void Setup(ref SecurityAssociation sa1, ref SecurityAssociation sa2) {
      sa1.Reset();
      sa2.Reset();
      sa1.RDHE.Value = sa2.LDHE;
      sa2.RDHE.Value = sa1.LDHE;

      Random rand = new Random();
      byte[] b = new byte[128];
      rand.NextBytes(b);
      MemBlock mb = MemBlock.Reference(b);

      sa1.DHEWithCertificateAndCAsOutHash.Value = mb;
      sa1.VerifyResponse(mb);

      b = new byte[128];
      rand.NextBytes(b);
      mb = MemBlock.Reference(b);

      sa2.DHEWithCertificateHash.Value = mb;
      sa2.VerifyRequest(mb);

      sa1.Enable();
      sa2.Enable();
      // This is just for kicks
      sa1.Enable();
    }
  }