コード例 #1
0
        internal override byte[] Sign(byte[] content, CoseSigner signer)
        {
            if (content == null)
            {
                return(CoseSign1Message.SignDetachedAsync(null !, signer).GetAwaiter().GetResult());
            }

            using Stream stream = GetTestStream(content);
            return(CoseSign1Message.SignDetachedAsync(stream, signer).GetAwaiter().GetResult());
        }
コード例 #2
0
        public async Task VerifyAsyncWithUnreadableStream()
        {
            using Stream stream = GetTestStream(s_sampleContent);
            byte[] encodedMsg = await CoseSign1Message.SignDetachedAsync(stream, GetCoseSigner(DefaultKey, DefaultHash));

            CoseSign1Message msg = CoseMessage.DecodeSign1(encodedMsg);

            using Stream unseekableStream = GetTestStream(s_sampleContent, StreamKind.Unreadable);
            await Assert.ThrowsAsync <ArgumentException>("detachedContent", () => msg.VerifyDetachedAsync(DefaultKey, unseekableStream));
        }
 internal override Task <byte[]> SignDetachedAsync(Stream detachedContent, CoseSigner signer, CoseHeaderMap?protectedHeaders = null, CoseHeaderMap?unprotectedHeaders = null, byte[]?associatedData = null)
 => CoseSign1Message.SignDetachedAsync(detachedContent, signer, associatedData);