Brunet.Security.SecurityDataMessage.Sign C# (CSharp) Метод

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

Signs a packet given a Hash algorithm.
public Sign ( HashAlgorithm hash ) : void
hash System.Security.Cryptography.HashAlgorithm
Результат void
    public void Sign(HashAlgorithm hash) {
      _signature = MemBlock.Reference(hash.ComputeHash(_unsigned_data));
      _update_icpacket = true;
    }

Usage Example

Пример #1
0
        /// <summary>First signs the data and then encrypts it.</summary>
        /// <param name="UnecryptedData">The data to sign and encrypt.</param>
        /// <returns>The signed and encrypted data.</returns>
        public void SignAndEncrypt(SecurityDataMessage sdm)
        {
            if (_closed)
            {
                throw new Exception("SecurityHandler: closed");
            }
            // Get the sequence id and increment the counter
            int seqid = ++_last_outgoing_seqid;

            // We ask for an update at the half life and every 1000 packets thereafter
            if (seqid == HALF_LIFE || (seqid > HALF_LIFE && seqid % 1000 == 0))
            {
                if (Update != null)
                {
                    Update(Epoch, EventArgs.Empty);
                }
            }

            sdm.Seqid = seqid;
            sdm.Epoch = Epoch;
            sdm.Sign(_outgoing_auth);
            sdm.Encrypt(_encryptor);
        }
All Usage Examples Of Brunet.Security.SecurityDataMessage::Sign