예제 #1
0
        /// <summary>
        /// Sign document hash.
        /// </summary>
        /// <param name="documentBytes">Document bytes</param>
        /// <param name="level">The document hash node level value in the aggregation tree</param>
        /// <returns></returns>
        public IKsiSignature Sign(byte[] documentBytes, uint level = 0)
        {
            if (documentBytes == null)
            {
                throw new ArgumentNullException(nameof(documentBytes));
            }

            IDataHasher dataHasher = KsiProvider.CreateDataHasher();

            dataHasher.AddData(documentBytes);
            return(_ksiService.Sign(dataHasher.GetHash(), level));
        }
예제 #2
0
        /// <summary>
        /// Sign document hash.
        /// </summary>
        /// <param name="stream">Stream containing document bytes</param>
        /// <param name="level">The document hash node level value in the aggregation tree</param>
        /// <returns></returns>
        public IKsiSignature Sign(Stream stream, uint level = 0)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            IDataHasher dataHasher = KsiProvider.CreateDataHasher();

            dataHasher.AddData(stream);
            return(_ksiService.Sign(dataHasher.GetHash(), level));
        }