Esempio n. 1
0
        public static void ExpectSignature_SHA256_1024_Stream()
        {
            byte[] expectedSignature = new byte[]
            {
                0x78, 0x6F, 0x42, 0x00, 0xF4, 0x5A, 0xDB, 0x09,
                0x72, 0xB9, 0xCD, 0xBE, 0xB8, 0x46, 0x54, 0xE0,
                0xCF, 0x02, 0xB5, 0xA1, 0xF1, 0x7C, 0xA7, 0x5A,
                0xCF, 0x09, 0x60, 0xB6, 0xFF, 0x6B, 0x8A, 0x92,
                0x8E, 0xB4, 0xD5, 0x2C, 0x64, 0x90, 0x3E, 0x38,
                0x8B, 0x1D, 0x7D, 0x0E, 0xE8, 0x3C, 0xF0, 0xB9,
                0xBB, 0xEF, 0x90, 0x49, 0x7E, 0x6A, 0x1C, 0xEC,
                0x51, 0xB9, 0x13, 0x9B, 0x02, 0x02, 0x66, 0x59,
                0xC6, 0xB1, 0x51, 0xBD, 0x17, 0x2E, 0x03, 0xEC,
                0x93, 0x2B, 0xE9, 0x41, 0x28, 0x57, 0x8C, 0xB2,
                0x42, 0x60, 0xDE, 0xB4, 0x18, 0x85, 0x81, 0x55,
                0xAE, 0x09, 0xD9, 0xC4, 0x87, 0x57, 0xD1, 0x90,
                0xB3, 0x18, 0xD2, 0x96, 0x18, 0x91, 0x2D, 0x38,
                0x98, 0x0E, 0x68, 0x3C, 0xA6, 0x2E, 0xFE, 0x0D,
                0xD0, 0x50, 0x18, 0x55, 0x75, 0xA9, 0x85, 0x40,
                0xAB, 0x72, 0xE6, 0x7F, 0x9F, 0xDC, 0x30, 0xB9,
            };

            byte[] signature;

            using (Stream stream = new PositionValueStream(10))
                using (var rsa = new RSACryptoServiceProvider())
                {
                    rsa.ImportParameters(TestData.RSA1024Params);
                    signature = rsa.SignData(stream, "SHA256");
                }

            Assert.Equal(expectedSignature, signature);
        }
Esempio n. 2
0
        public static void ExpectSignature_SHA256_1024_Stream()
        {
            byte[] expectedSignature = new byte[]
            {
                0x78, 0x6F, 0x42, 0x00, 0xF4, 0x5A, 0xDB, 0x09,
                0x72, 0xB9, 0xCD, 0xBE, 0xB8, 0x46, 0x54, 0xE0,
                0xCF, 0x02, 0xB5, 0xA1, 0xF1, 0x7C, 0xA7, 0x5A,
                0xCF, 0x09, 0x60, 0xB6, 0xFF, 0x6B, 0x8A, 0x92,
                0x8E, 0xB4, 0xD5, 0x2C, 0x64, 0x90, 0x3E, 0x38,
                0x8B, 0x1D, 0x7D, 0x0E, 0xE8, 0x3C, 0xF0, 0xB9,
                0xBB, 0xEF, 0x90, 0x49, 0x7E, 0x6A, 0x1C, 0xEC,
                0x51, 0xB9, 0x13, 0x9B, 0x02, 0x02, 0x66, 0x59,
                0xC6, 0xB1, 0x51, 0xBD, 0x17, 0x2E, 0x03, 0xEC,
                0x93, 0x2B, 0xE9, 0x41, 0x28, 0x57, 0x8C, 0xB2,
                0x42, 0x60, 0xDE, 0xB4, 0x18, 0x85, 0x81, 0x55,
                0xAE, 0x09, 0xD9, 0xC4, 0x87, 0x57, 0xD1, 0x90,
                0xB3, 0x18, 0xD2, 0x96, 0x18, 0x91, 0x2D, 0x38,
                0x98, 0x0E, 0x68, 0x3C, 0xA6, 0x2E, 0xFE, 0x0D,
                0xD0, 0x50, 0x18, 0x55, 0x75, 0xA9, 0x85, 0x40,
                0xAB, 0x72, 0xE6, 0x7F, 0x9F, 0xDC, 0x30, 0xB9,
            };

            byte[] signature;

            using (Stream stream = new PositionValueStream(10))
            using (var rsa = new RSACryptoServiceProvider())
            {
                rsa.ImportParameters(TestData.RSA1024Params);
                signature = rsa.SignData(stream, "SHA256");
            }

            Assert.Equal(expectedSignature, signature);
        }