Brunet.Security.PeerSec.PeerSecAssociationTest.Setup C# (CSharp) Method

Setup() protected method

protected Setup ( PeerSecAssociation sa1, PeerSecAssociation sa2 ) : void
sa1 PeerSecAssociation
sa2 PeerSecAssociation
return void
    protected void Setup(PeerSecAssociation sa1, PeerSecAssociation 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();
    }
  }