Example #1
0
        /// <summary>
        /// Callback signs the digest with X509SignatureGenerator.
        /// </summary>
        public object GetResult()
        {
            var memStream = Stream as MemoryStream;
            var digest    = memStream.ToArray();
            var signature = _generator.SignData(digest, _hashAlgorithm);

            return(new MemoryBlockResult(signature));
        }
Example #2
0
        public Task <byte[]> SignAsync(MemoryStream source)
        {
            Logger.LogInformation($"start {nameof(SignAsync)}");
            var pos = source.Position;

            source.Position = 0;
            var signatureCert = VerificationKeyGenerator.SignData(source.ToArray(), HashAlgorithmName.SHA256);

            source.Position = pos;
            return(Task.FromResult(signatureCert));
        }
Example #3
0
            /// <summary>
            /// Callback signs the digest with X509SignatureGenerator.
            /// </summary>
            public object GetResult()
            {
                var memStream = Stream as MemoryStream;

                if (memStream == null)
                {
                    throw new ArgumentNullException(nameof(Stream));
                }
                var digest    = memStream.ToArray();
                var signature = _generator.SignData(digest, _hashAlgorithm);

                return(new MemoryBlockResult(signature));
            }
Example #4
0
 public override byte[] SignData(byte[] data, HashAlgorithmName hashAlgorithm) =>
 _realRsaGenerator.SignData(data, hashAlgorithm);