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

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

Verifies the hash with the DHEWithCertificateHash.
public VerifyRequest ( MemBlock hash ) : bool
hash MemBlock
Результат bool
    public bool VerifyRequest(MemBlock hash) {
      if(DHEWithCertificateHash.Value == null) {
        throw new Exception("Hash not set!");
      } else if(!DHEWithCertificateHash.Value.Equals(hash)) {
        throw new Exception("Hash does not match!");
      }
      _hash_verified = true;
      return hash.Equals(DHEWithCertificateHash.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::VerifyRequest