示例#1
0
        /// <summary>
        /// Sign passed request with authority private key.
        /// </summary>
        /// <param name="request">request for signing.</param>
        /// <param name="appId">authority id.</param>
        /// <param name="appKey">authority private key to sign with.</param>
        public void AuthoritySign(ISignableRequest request, string appId, IPrivateKey appKey)
        {
            var fingerprint = this.crypto.CalculateFingerprint(request.Snapshot);
            var signature   = this.crypto.Sign(fingerprint.GetValue(), appKey);

            request.AppendSignature(appId, signature);
        }
示例#2
0
        /// <summary>
        /// Sign passed request with private key.
        /// </summary>
        /// <param name="request">request for signing.</param>
        /// <param name="privateKey">private key to sign with.</param>
        public void SelfSign(ISignableRequest request, IPrivateKey privateKey)
        {
            var fingerprint = this.crypto.CalculateFingerprint(request.Snapshot);
            var signature   = this.crypto.Sign(fingerprint.GetValue(), privateKey);

            request.AppendSignature(fingerprint.ToHEX(), signature);
        }