Brunet.Security.PeerSec.PeerSecAssociation.VerifyResponse C# (CSharp) Метод

VerifyResponse() публичный Метод

Verifies the hash to the DHEWithCertificateAndCAsOutHash.
public VerifyResponse ( MemBlock hash ) : bool
hash MemBlock
Результат bool
    public bool VerifyResponse(MemBlock hash) {
      if(DHEWithCertificateAndCAsOutHash.Value == null) {
        throw new Exception("Hash not set!");
      } else if(!DHEWithCertificateAndCAsOutHash.Value.Equals(hash)) {
        throw new Exception("Hash does not match!");
      }
      _hash_verified = true;
      return hash.Equals(DHEWithCertificateAndCAsOutHash.Value);
    }

Usage Example

Пример #1
0
        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();
        }
All Usage Examples Of Brunet.Security.PeerSec.PeerSecAssociation::VerifyResponse