private static void ValidateMembers(IEnumerator e)
        {
            RecipientInfo[] recipients = new RecipientInfo[3];

            Assert.True(e.MoveNext());
            recipients[0] = (RecipientInfo)(e.Current);
            Assert.True(e.MoveNext());
            recipients[1] = (RecipientInfo)(e.Current);
            Assert.True(e.MoveNext());
            recipients[2] = (RecipientInfo)(e.Current);
            Assert.False(e.MoveNext());

            X509IssuerSerial[] si = recipients.Select(r => (X509IssuerSerial)(r.RecipientIdentifier.Value)).OrderBy(x => x.IssuerName).ToArray();
            Assert.Equal("CN=RSAKeyTransfer1", si[0].IssuerName);
            Assert.Equal("CN=RSAKeyTransfer2", si[1].IssuerName);
            Assert.Equal("CN=RSAKeyTransfer3", si[2].IssuerName);
        }
Beispiel #2
0
        private static void VerifyRecipients3(byte[] encodedMessage)
        {
            string[] expectedIssuers = s_certs.Select(c => c.Issuer).OrderBy(s => s).ToArray();

            EnvelopedCms ecms = new EnvelopedCms();

            ecms.Decode(encodedMessage);

            RecipientInfoCollection col = ecms.RecipientInfos;
            int numRecipients           = col.Count;

            Assert.Equal(3, numRecipients);

            RecipientInfo[] recipients = new RecipientInfo[numRecipients];
            col.CopyTo(recipients, 0);

            string[] actualIssuers = recipients.Select(r => r.RecipientIdentifier.Value).Cast <X509IssuerSerial>().Select(xis => xis.IssuerName).OrderBy(s => s).ToArray();
            Assert.Equal <string>(expectedIssuers, actualIssuers);
        }