当前位置: 首页>>代码示例>>C#>>正文


C# Permissions.StrongNamePublicKeyBlob类代码示例

本文整理汇总了C#中System.Security.Permissions.StrongNamePublicKeyBlob的典型用法代码示例。如果您正苦于以下问题:C# StrongNamePublicKeyBlob类的具体用法?C# StrongNamePublicKeyBlob怎么用?C# StrongNamePublicKeyBlob使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StrongNamePublicKeyBlob类属于System.Security.Permissions命名空间,在下文中一共展示了StrongNamePublicKeyBlob类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromXml

	// Convert an XML value into a permissions value.
	public override void FromXml(SecurityElement esd)
			{
				if(esd == null)
				{
					throw new ArgumentNullException("esd");
				}
				if(esd.Attribute("version") != "1")
				{
					throw new ArgumentException(_("Arg_PermissionVersion"));
				}
				name = esd.Attribute("Name");
				String value = esd.Attribute("Version");
				if(value != null)
				{
					version = new Version(value);
				}
				else
				{
					version = null;
				}
				value = esd.Attribute("PublicKeyBlob");
				if(value != null)
				{
					blob = new StrongNamePublicKeyBlob(value);
				}
				else
				{
					blob = null;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:31,代码来源:StrongNameIdentityPermission.cs

示例2: PublicKey

	public void PublicKey () 
	{
		StrongNamePublicKeyBlob snpkb = new StrongNamePublicKeyBlob (pk);
		Assert.IsTrue (snpkb.Equals (snpkb), "Equals(Self)");
		Assert.IsFalse (snpkb.Equals (null), "Equals(null)");
		Assert.AreEqual ("00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB", snpkb.ToString (), "ToString(pk)");

		StrongNamePublicKeyBlob snpkb2 = new StrongNamePublicKeyBlob (pk);
		Assert.IsTrue (snpkb.Equals (snpkb2), "Equals()-true");
		StrongNamePublicKeyBlob snpkb3 = new StrongNamePublicKeyBlob (bad);
		Assert.IsFalse (snpkb.Equals (snpkb3), "Equals()-false");

		// non standard get hash code - why ???
		Assert.AreEqual (snpkb2.GetHashCode (), snpkb.GetHashCode (), "GetHashCode-0");

		// the first 4 bytes has code has been fixed in 2.0 beta 1

// Historical data:
// #elif NET_1_1
// 		// It seems to be the first four bytes of the public key data
// 		// which seems like non sense as all valid public key will have the same header ?
// 		Assert.AreEqual (2359296, snpkb.GetHashCode (), "GetHashCode-1");
// 		Assert.AreEqual (2359296, snpkb2.GetHashCode (), "GetHashCode-2");
// 		Assert.AreEqual (2989, snpkb3.GetHashCode (), "GetHashCode-3");
// 		byte[] header = { 0x00, 0x24, 0x00, 0x00 };
// 		StrongNamePublicKeyBlob snpkb4 = new StrongNamePublicKeyBlob (header);
// 		Assert.AreEqual (2359296, snpkb4.GetHashCode (), "GetHashCode-4");
// #endif
	}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:29,代码来源:StrongNamePublicKeyBlobTest.cs

示例3: Equals

 internal bool Equals( StrongNamePublicKeyBlob blob )
 {
     if (blob == null)
         return false;
     else 
         return CompareArrays( this.PublicKey, blob.PublicKey );
 }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:7,代码来源:StrongNamePublicKeyBlob.cs

示例4: StrongName

 internal StrongName(StrongNamePublicKeyBlob blob, string name, System.Version version, Assembly assembly)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
     }
     if (blob == null)
     {
         throw new ArgumentNullException("blob");
     }
     if (version == null)
     {
         throw new ArgumentNullException("version");
     }
     RuntimeAssembly assembly2 = assembly as RuntimeAssembly;
     if ((assembly != null) && (assembly2 == null))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"), "assembly");
     }
     this.m_publicKeyBlob = blob;
     this.m_name = name;
     this.m_version = version;
     this.m_assembly = assembly2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:StrongName.cs

示例5: GetUnion

		private StrongNameIdentityPermission GetUnion ()
		{
			StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
			StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
			StrongNamePublicKeyBlob blob2 = new StrongNamePublicKeyBlob (new byte[16]);
			StrongNameIdentityPermission diffPk = new StrongNameIdentityPermission (blob2, "mono", new Version (1, 2, 3, 4));
			return (StrongNameIdentityPermission)snip.Union (diffPk);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:StrongNameIdentityPermissionTest.cs

示例6: StrongNameIdentityPermission

 /// <include file='doc\StrongNameIdentityPermission.uex' path='docs/doc[@for="StrongNameIdentityPermission.StrongNameIdentityPermission1"]/*' />
 public StrongNameIdentityPermission( StrongNamePublicKeyBlob blob, String name, Version version )
 {
     if (blob == null)
         throw new ArgumentNullException( "blob" );
 
     m_publicKeyBlob = blob;
     m_name = name;
     m_version = version;
 }
开发者ID:ArildF,项目名称:masters,代码行数:10,代码来源:strongnameidentitypermission.cs

示例7: StrongNameMembershipCondition

                public StrongNameMembershipCondition (StrongNamePublicKeyBlob blob, string name, Version version)
                {
                        if (blob == null)
                                throw new ArgumentNullException ("blob");

                        this.blob = blob;
                        this.name = name;
			if (version != null)
	                        assemblyVersion = (Version) version.Clone ();
                }
开发者ID:jack-pappas,项目名称:mono,代码行数:10,代码来源:StrongNameMembershipCondition.cs

示例8: ArgumentNullException

	public StrongNameMembershipCondition
				(StrongNamePublicKeyBlob blob, String name, Version version)
			{
				if(blob == null)
				{
					throw new ArgumentNullException("blob");
				}
				this.blob = blob;
				this.name = name;
				this.version = version;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:StrongNameMembershipCondition.cs

示例9: StrongNameIdentityPermission

 public StrongNameIdentityPermission(StrongNamePublicKeyBlob blob, string name, System.Version version)
 {
     if (blob == null)
     {
         throw new ArgumentNullException("blob");
     }
     if ((name != null) && name.Equals(""))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
     }
     this.m_unrestricted = false;
     this.m_strongNames = new StrongName2[] { new StrongName2(blob, name, version) };
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:StrongNameIdentityPermission.cs

示例10: StrongName

	public StrongName (StrongNamePublicKeyBlob blob, string name, Version version) 
	{
		if (blob == null)
			throw new ArgumentNullException ("blob");
		if (name == null)
			throw new ArgumentNullException ("name");
		if (version == null)
			throw new ArgumentNullException ("version");
		if (name.Length == 0)
			throw new ArgumentException (Locale.GetText ("Empty"), "name");
		publickey = blob;
		this.name = name;
		this.version = version;
	}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:14,代码来源:StrongName.cs

示例11: StrongNameMembershipCondition

 public StrongNameMembershipCondition(StrongNamePublicKeyBlob blob, string name, System.Version version)
 {
     if (blob == null)
     {
         throw new ArgumentNullException("blob");
     }
     if ((name != null) && name.Equals(""))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_EmptyStrongName"));
     }
     this.m_publicKeyBlob = blob;
     this.m_name = name;
     this.m_version = version;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:StrongNameMembershipCondition.cs

示例12: StrongName

 /// <include file='doc\StrongName.uex' path='docs/doc[@for="StrongName.StrongName1"]/*' />
 public StrongName( StrongNamePublicKeyBlob blob, String name, Version version )
 {
     if (name == null)
         throw new ArgumentNullException( "name" );
         
     if (blob == null)
         throw new ArgumentNullException( "blob" );
         
     if ((Object) version == null)
         throw new ArgumentNullException( "version" );
         
     m_publicKeyBlob = blob;
     m_name = name;
     m_version = version;
 }
开发者ID:ArildF,项目名称:masters,代码行数:16,代码来源:strongname.cs

示例13: StrongName

        public StrongName( StrongNamePublicKeyBlob blob, String name, Version version )
        {
            if (name == null)
                throw new ArgumentNullException( "name" );
            if (name.Equals( "" ))
                throw new ArgumentException( Environment.GetResourceString( "Argument_EmptyStrongName" ) );      

            if (blob == null)
                throw new ArgumentNullException( "blob" );

            if (version == null)
                throw new ArgumentNullException( "version" );

            m_publicKeyBlob = blob;
            m_name = name;
            m_version = version;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:17,代码来源:strongname.cs

示例14: GetStrongName

        public static StrongName GetStrongName(Assembly assembly)
        {
            if (assembly == null)
                throw new ArgumentNullException("assembly");

            AssemblyName assemblyName = assembly.GetName();
            Debug.Assert(assemblyName != null, "Could not get assembly name");

            // Get the public key blob.
            byte[] publicKey = assemblyName.GetPublicKey();
            if (publicKey == null || publicKey.Length == 0)
                throw new InvalidOperationException("Assembly is not strongly named");

            var keyBlob = new StrongNamePublicKeyBlob(publicKey);

            // Return the strong name.
            return new StrongName(keyBlob, assemblyName.Name, assemblyName.Version);
        }
开发者ID:markthor,项目名称:robocode,代码行数:18,代码来源:Reflection.cs

示例15: StrongName

	// Constructor.
	public StrongName(StrongNamePublicKeyBlob blob,
					  String name, Version version)
			{
				if(blob == null)
				{
					throw new ArgumentNullException("blob");
				}
				if(name == null)
				{
					throw new ArgumentNullException("name");
				}
				if(version == null)
				{
					throw new ArgumentNullException("version");
				}
				this.blob = blob;
				this.name = name;
				this.version = version;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:StrongName.cs


注:本文中的System.Security.Permissions.StrongNamePublicKeyBlob类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。