Exemple #1
0
        public async Task VerifyReturnsFalseIfSignatureIsNull()
        {
            var base64Content = "Hello World!".ToBase64Url();
            var content       = new AttachmentContent {
                Base64 = base64Content
            };

            var result = await content.VerifyJsonWebSignature();

            Assert.False(result);
        }
Exemple #2
0
        public async Task CanVerifySignedAttachmentContent()
        {
            var base64Content = "Hello World!".ToBase64Url();
            var content       = new AttachmentContent {
                Base64 = base64Content
            };
            var key = await Crypto.CreateKeyAsync(_agent.Wallet, "{}");

            await content.SignWithJsonWebSignature(_agent.Wallet, key);

            var result = await content.VerifyJsonWebSignature();

            Assert.True(result);
        }
Exemple #3
0
        public async Task VerifyReturnsFalseWithWrongSignature()
        {
            var base64Content = "Hello World!".ToBase64Url();
            var content       = new AttachmentContent {
                Base64 = base64Content
            };
            var key = await Crypto.CreateKeyAsync(_agent.Wallet, "{}");

            await content.SignWithJsonWebSignature(_agent.Wallet, key);

            content.Base64 = "Changed content".ToBase64Url();

            var result = await content.VerifyJsonWebSignature();

            Assert.False(result);
        }