应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt

上传人:rrsccc 文档编号:9793407 上传时间:2021-03-26 格式:PPT 页数:42 大小:532.50KB
返回 下载 相关 举报
应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt_第1页
第1页 / 共42页
应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt_第2页
第2页 / 共42页
应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt_第3页
第3页 / 共42页
应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt_第4页
第4页 / 共42页
应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt_第5页
第5页 / 共42页
点击查看更多>>
资源描述

《应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt》由会员分享,可在线阅读,更多相关《应用MicrosoftNetFramework编写安全的应用程序PPT课件.ppt(42页珍藏版)》请在三一文库上搜索。

1、1,2,应用Microsoft .NET Framework编写安全的应用程序,钟卫 DPE 微软公司,3,Session Prerequisites,Development experience with Microsoft Visual Basic, Microsoft Visual C+, or C# Experience building Microsoft Windows or Web applications using the .NET Framework,Level 200,4,课程概述,.NET Framework 安全特性 代码访问安全 角色访问安全 构建安全的ASP.NE

2、T Web 应用 构建安全的ASP.NET Web Services应用,5,.NET Framework 安全特性,.NET Framework 安全特性 代码访问安全 角色访问安全 构建安全的ASP.NET Web 应用 构建安全的ASP.NET Web Services应用,6,.NET 托管代码的执行安全,.NET Framework 安全特性 帮助您开发更加安全的应用 内置很多的安全组件 类型察看 异常管理 安全引擎 与Windows 的安全性相互补充 具备很高的灵活性和扩展性,7,类型安全的系统,类型安全代码 防范缓冲区溢出 授权方式限制访问内存 允许相同进程运行多程序集 应用程序

3、域提供: 性能增强 代码安全性的增强,8,代码访问安全,.NET Framework 安全特性 代码访问安全 角色访问安全 构建安全的ASP.NET Web 应用 构建安全的ASP.NET Web Services应用,9,应用类型检验防范内存改写 在.NET 中System.String的声明和调用没发生改变 .NET 中的System.Text.StringBuilder提供了缓冲区边界检查,缓冲区溢出保护,void CopyString (string src) stringDest = src; ,10,算法错误检查,对算法的错误检查通过: 关键字检查 项目设定,byte b=0; w

4、hile (true) Console.WriteLine (b); checked b+; ,11,强命名 具有唯一的标识符 被用于对程序集的数字签名 经过强命名的程序集 防止被篡改 确认程序集原有者的身份 允许组件并行调用,强命名保护,sn k MyFullKey.snk,12,独立存储,IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly();,提供了一个虚拟的文件系统 允许设置配额 文件的独立存储通过 应用身份确认 用户身份确认,Internet Zone apps get 10MB by

5、default Internet 域给应用程序默认分配10MB的空间,13,基于证据的安全机制,证据: 当程序集被访问时评估证据 被用于确定程序集所具有的权限 包含了程序集的: 强命名信息 URL(可信,非可信) Zone(安全区域) 可信的代码签名 用户自定义信息,14,安全策略,15,步入调用堆栈的安全机制,Call stack,Security system,YourAssembly,SomeAssembly,.NET framework assembly,Grant: Execute,1. An assembly requests access to a method in your

6、assembly 2. Your assembly passes the request to a .NET Framework assembly 3. The security system ensures that all callers in the stack have the required permissions 4. The security system grants access or throws an exception,Grant: ReadFile,Grant: ReadFile,Permission demand,Security exception Access

7、 denied,Grant access?,16,访问许可请求,开发者通过许可请求获取必须的权限 属性引用实现 除非具备了运行程序的最小权限,否则不能运行,/I will only run if I can call unmanaged code assembly:SecurityPermission (SecurityAction.RequestMinimum, UnmanagedCode=true),17,Demonstration 1: Code Access Security,Using the .NET Framework Configuration Tool Performing

8、Security Checks Requesting Permissions,18,部分信任的程序集,.NET Framework 1.1之前的web应用都是full trust运行 .NET Framework 1.1提供下面几种信任级别: Full High Medium Low Minimal,19,角色访问安全,.NET Framework 安全特性 代码访问安全 角色访问安全 加密 构建安全的ASP.NET Web 应用 构建安全的ASP.NET Web Services应用,20,认证和授权,认证需要解决Who are you?Am I sure you are who you s

9、ay you are? 授权需要解决Are you allowed to ?,21,Identities and Principals,identity 包含了一个用户的信息,比如用户的登陆名称 principal 包含了一种角色的信息,比如角色包含的用户和计算机 .NET Framework 提供了: WindowsIdentity and WindowsPrincipal objects GenericIdentity and GenericPrincipal objects,22,使用WindowsIdentity和WindowsPrincipal 对象,WindowsIdentity

10、myIdent = WindowsIdentity.GetCurrent(); WindowsPrincipal myPrin = new WindowsPrincipal(myIdent);,AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal myPrin = (Thread.CurrentPrincipal as WindowsPrincipal);,Single validation,Repeated validation,创建Windows Iden

11、tities and Principals,23,创建 Generic Identities and Principals,GenericIdentity myIdent = new GenericIdentity(User1); string roles = Manager, Teller; GenericPrincipal myPrin = new GenericPrincipal(myIdent, roles);,System.Threading.Thread.CurrentPrincipal = myPrin;,创建一个 GenericIdentity 和 GenericPrincip

12、al 将创建的GenericPrincipal加载到当前的策略上,24,执行安全检查,if (String.Compare(myPrin.Identity.Name, DOMAINFred, true)=0) / Perform some action ,if (myPrin.IsInRole(BUILTINAdministrators) / Perform some action ,在代码中使用Identity and Principal members 比如,使用Identity.Name属性校验用户的登陆名称,比如,使用类Principal的IsInRole方法检验角色 成员,25,Pr

13、incipalPermission prinPerm = new PrincipalPermission(Teller, “Manager”, true); try prinPerm.Demand(); /Does the above match the active principal? ,PrincipalPermission(SecurityAction.Demand, Role=Teller, Authenticated=true),Use permissions to perform role-based security checks 命令式,声明式 (通过属性调用实现),命令与声

14、明式的安全检查,26,Demonstration 2: Role-Based Security,Using Windows Role-Based Security Using Generic Role-Based Security,27,构建安全的ASP.NET Web 应用,.NET Framework 安全特性 代码访问安全 角色访问安全 加密 构建安全的ASP.NET Web 应用 构建安全的ASP.NET Web Services应用,28,ASP.NET认证方式,29, ,基于Forms认证方式的设置,设置IIS Anonymous authentication 通过设置Web.co

15、nfig 建立Form认证方式 建立授权 创建一个登陆叶面,30,开发人员可以通过设置确保cookies安全, ,开发人员可以创建 application-specific keys来加解密cookies,窗体认证方式的增强,31,校验控件,客户端校验 提供即时反馈 减少postback 服务器校验 重复了客户端的校验 可以结合存储的数据进行验证,32,校验控件的类型,33,Demonstration 4: ASP.NET Web Application Security,Configuring Forms Authentication Using Validation Controls,34

16、,构建安全的ASP.NET Web Services应用,.NET Framework 安全特性 代码访问安全 角色访问安全 加密 构建安全的ASP.NET Web 应用 构建安全的ASP.NET Web Services应用,35,消息级别的安全,36,Web Service Enhancements (WSE),包含以下内容: SOAP headers包含认证信息 支持消息加密 支持消息数字签名 支持消息路由 支持附件传递 通过程序集 Microsoft.Web.Services.dll 运行,37,Demonstration 5: Web Services Enhancements,Im

17、plementing Security for a Web Service A look at WSE messages,38,Next Steps,Stay informed about security Sign up for security bulletins: Get the latest Microsoft security guidance: Get additional security training Find online and in-person training seminars: Find a local CTEC for hands-on training: ,39,For More Information,Microsoft Security Site (all audiences) MSDN Security Site (developers) TechNet Security Site (IT professionals) ,40,Questions and Answers,41,个人观点供参考,欢迎讨论,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1