Example #1
0
        internal static StrongNameMembershipCondition StrongNameMembershipConditionFromPublicKeyBlob(string publicKeyBlob)
        {
            // create a security IMembershipCondition element. goal is to construct an xml like this:
            // <IMembershipCondition class="StrongNameMembershipCondition"
            //        version="1"
            //        PublicKeyBlob="012456789" />
            SecurityElement se = new SecurityElement("IMembershipCondition");

            se.AddAttribute("class", "StrongNameMembershipCondition");
            se.AddAttribute("version", "1");
            se.AddAttribute("PublicKeyBlob", publicKeyBlob);

            // create a StrongNamePublicKeyBlob. it doesn't matter the key
            StrongNamePublicKeyBlob keyBlob = new StrongNamePublicKeyBlob(new byte[] { 0x00 });

            // create the StrongNameMembershipCondition to return
            StrongNameMembershipCondition snmc = new StrongNameMembershipCondition(keyBlob, null, null);

            // fill the StrongNameMembershipCondition from the built xml
            snmc.FromXml(se);

            // return the StrongNameMembershipCondition
            return(snmc);
        }
Example #2
0
        public void FromXml_Null()
        {
            StrongNameMembershipCondition snmc = new StrongNameMembershipCondition(blob, name, version);

            snmc.FromXml(null);
        }