网站首页站长博客下载中心域名交易站长论坛域名主机免费电邮免费域名中文排行排名查询站长书库书籍教程下载
设为首页
加入收藏
总编信箱
投稿或申请专栏请先 [登 陆]
学院首页 网络编程 网页设计 图形图象 数 据 库 服 务 器 网络媒体 网络安全 个人专栏 站长CLUB 业界新闻 信息公告
 当前位置:首页 >> 网络编程 >> NET专区 >> 正文
公告通知
返回上级列表
资料搜索
相关文章
用户自定义控件的应用
c#.net常用函数和方法集
在VB中使用水晶报表的一种简易编
C#调用父类的父类的方法
浏览.NET Framework 2.0 类型库中
为.Text Blog 添加 计数器
编程实现邮件地址有效性检测 
VB/VB.NET/C#导出到Excel的方法
c#高性能在WEB端产生验证图片
用System.Web.Caching.Cache保存
程序集应该拥有一个有效的强名称
[ 来源:CSDN | 作者:未知 | 时间:2006-4-15 6:59:38 | 浏览:人次 ]
收藏到新浪ViVi 收藏到365KEY 收藏到我摘  字号选择〖    〗/ 双击滚屏 单击停止  

Assemblies should have valid strong names

TypeName:

AssembliesShouldHaveValidStrongNames

CheckId:

CA2210

Category:

Microsoft.Design

Message Level:

CriticalError

Certainty:

95%

Breaking Change:

NonBreaking


Cause: An assembly is not signed with a strong name, the strong name could not be verified, or the strong name would not be valid without the current registry settings of the computer.

Rule Description

This rule retrieves and verifies the strong name of an assembly. A violation occurs if any of the following are true:

  • The assembly does not have a strong name.

  • The assembly was altered after signing.

  • The assembly is delay-signed.

  • The assembly was incorrectly signed, or signing failed.

  • The assembly requires registry settings to pass verification. For example, the Strong Name tool (Sn.exe) was used to skip verification for the assembly.

The strong name protects clients from unknowingly loading an assembly that has been tampered with. Assemblies without strong names should not be deployed outside of very limited scenarios. If you share or distribute assemblies that are not correctly signed, the assembly can be tampered with, the common language runtime might not load the assembly, or the user might have to disable verification on his or her computer. An assembly without a strong name suffers from the following drawbacks:

  • Its origins cannot be verified.

  • The common language runtime cannot warn users if the contents of the assembly have been altered.

  • It cannot be loaded into the global assembly cache.

Note that to load and analyze a delay-signed assembly, you must disable verification for the assembly.

How to Fix Violations

To fix a violation of this rule, use the Strong Name tool (sn.exe) to create a key file and sign the assembly with a strong name using one of the following procedures:

When to Exclude Messages

Only exclude a message from this rule if the assembly is used in an environment where tampering with the contents is not a concern.

引起的原因:

1.  程序集没有使用强名称进行签名

2.  强名称不能被校验

3.  该程序集的强名称依赖于当前计算机的设置才有效。

描述:

这个规则读取并校验一个程序集的强名称,下面任何一条都会引起这条规则校验失败:

1.  这个程序集没有进行强名称签名

2.  进行签名后,这个程序集被修改过。

3.  程序集被设置成延迟签名

4.  程序集签名失败

5.  程序集需要一定的注册表设置才能通过强名称校验

例如:通过强名称工具(Sn.exe)设置跳过对这个程序集的强名称确认

 

强名称保护用户不会使用一个被篡改的程序集。一个没有强名称的程序集只能被使用在非常小的范围内。如果你分发一个没有进行正确签名的程序集,将不能保证它没有被篡改。如果用户没有设置忽略强名称确认,CLR将会拒绝载入这个程序集。

 

不对程序集进行强名称签名会有如下缺点:

1.  程序集的来源将不能被保证

2.  用户将无法知道程序集被篡改过

3.  程序集不能被载入GAC(全局程序集缓存)

如果需要分析一个延迟签名的程序集,必须禁用这条规则。

修复:

使用强名称工具生成Key文件,并用这个文件签名程序集。你可以使用下面的一种方法签名这个程序集:

1.  使用.NET Framework SDK中的程序集连接工具(Al.exe)

2.  .NET Framework v1.0v1.1中,使用System.Reflection.AssemblyKeyFileAttributeSystem.Reflection.AssemblyKeyNameAttribute属性标记程序集。

3.  .NET Framework v2.0中,使用/keyfile或者/keycontainer编译指令。(在C++中,使用/KEYFILE or /KEYCONTAINER连接指令)。


[发送给好友]  [打印本页]  [关闭窗口]  [返回顶部]   转载请注明来源:http://edu.chinaz.com   
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
栏目编辑: 设计风 责任编辑: keke
原始作者: 未知 录入时间: 2006-4-15 6:59:38
信息来源: CSDN 投稿信箱: Edu#chinaz.com
设为首页 - 加入收藏 - 关于我们 - 广告服务 - 版权申明 - 友情链接 - 联系方式 - 总编信箱 - 会员投稿