public void CopyFrom_BadData()
        {
            byte[]             data = { 0x30, 0x18, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x03, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01 };
            AsnEncodedData     aed  = new AsnEncodedData(data);
            Pkcs9MessageDigest md   = new Pkcs9MessageDigest();

            md.CopyFrom(aed);
        }
        public void CopyFrom()
        {
            byte[]             data = { 0x04, 0x10, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
            AsnEncodedData     aed  = new AsnEncodedData(data);
            Pkcs9MessageDigest md   = new Pkcs9MessageDigest();

            md.CopyFrom(aed);
        }
Пример #3
0
        public static void MessageDigestFromRawData()
        {
            byte[]      messageDigest            = { 3, 45, 88, 128, 93 };
            List <byte> encodedMessageDigestList = new List <byte>(messageDigest.Length + 2);

            encodedMessageDigestList.Add(4);
            encodedMessageDigestList.Add(checked ((byte)(messageDigest.Length)));
            encodedMessageDigestList.AddRange(messageDigest);
            byte[] encodedMessageDigest = encodedMessageDigestList.ToArray();

            Pkcs9MessageDigest   p          = new Pkcs9MessageDigest();
            Pkcs9AttributeObject pAttribute = new Pkcs9AttributeObject(s_OidMessageDigest, encodedMessageDigest);

            p.CopyFrom(pAttribute);
            Assert.Equal <byte>(encodedMessageDigest, p.RawData);
            Assert.Equal <byte>(messageDigest, p.MessageDigest);
            string oid = p.Oid.Value;

            Assert.Equal(s_OidMessageDigest, oid);
        }