示例#1
0
        public void Test_GetKeyPair()
        {
            var keyPair = ModuleScope.GetKeyPair();

            Assert.AreEqual(keyPair.Count(), 596);
            foreach (var k in keyPair)
            {
                Console.WriteLine("Key:{0}", k.ToString());
            }
        }
示例#2
0
        private static void CheckSignedSavedAssembly(string path)
        {
            Assert.IsTrue(File.Exists(path));

            var assemblyName = AssemblyName.GetAssemblyName(path);

            Assert.AreEqual(ModuleScope.DEFAULT_ASSEMBLY_NAME, assemblyName.Name);

            var keyPairBytes    = ModuleScope.GetKeyPair();
            var keyPair         = new StrongNameKeyPair(keyPairBytes);
            var loadedPublicKey = assemblyName.GetPublicKey();

            Assert.AreEqual(keyPair.PublicKey.Length, loadedPublicKey.Length);
            for (var i = 0; i < keyPair.PublicKey.Length; ++i)
            {
                Assert.AreEqual(keyPair.PublicKey[i], loadedPublicKey[i]);
            }
        }