Exemple #1
0
        public void testHasContent()
        {
            Message instance  = new EncryptMessage();
            Boolean expResult = false;
            Boolean result    = instance.HasContent();

            Assert.AreEqual(expResult, (expResult));

            instance.SetContent(new byte[10]);
            result = instance.HasContent();
            Assert.AreEqual(result, (true));
        }
Exemple #2
0
        public void testDecodeFromBytes_byteArr_MessageTag()
        {
            EncryptMessage msg = new EncryptMessage(true, false);

            msg.AddAttribute(HeaderKeys.Algorithm, AlgorithmValues.AES_GCM_128, Attributes.PROTECTED);
            msg.AddAttribute(HeaderKeys.IV, CBORObject.FromObject(rgbIV96), Attributes.PROTECTED);
            msg.SetContent(rgbContent);
            msg.Encrypt(rgbKey128);
            byte[] rgbMsg = msg.EncodeToBytes();

            msg = (EncryptMessage)Message.DecodeFromBytes(rgbMsg);
            Assert.AreEqual(false, (msg.HasContent()));
        }