public void TestRoundTrip4() { EncryptMessage msg = new EncryptMessage(); msg.AddAttribute(HeaderKeys.Algorithm, AlgorithmValues.AES_GCM_128, Attributes.PROTECTED); msg.AddAttribute(HeaderKeys.IV, CBORObject.FromObject(rgbIV96), Attributes.PROTECTED); msg.SetContent(rgbContent); msg.AddRecipient(recipient128); msg.Encrypt(); List <Recipient> rList = msg.RecipientList; Assert.AreEqual(rList.Count(), (1)); CBORObject rgbMsg = msg.EncodeToCBORObject(); msg = EncryptMessage.DecodeFromCBOR(rgbMsg); Recipient r = msg.RecipientList[0]; r.SetKey(cnKey128); byte[] contentNew = msg.Decrypt(r); CollectionAssert.AreEqual(contentNew, (rgbContent)); }