`
tetsu.soh
  • 浏览: 77387 次
  • 性别: Icon_minigender_1
  • 来自: 东京
社区版块
存档分类
最新评论

SASL, JAAS, JSSE & Java GSS-API总结

阅读更多
SASL JAAS JSSE JGSS-API

全称:
SASL(Simple Authentication and Security Layer)
JAAS(JAVA Authentication and Authorization Service)
JSSE(Secure Socket Extension)
Java GSS-API(Java Generic Security Service Application Programming Interface)

定义:
JAAS -- JAAS implements a Java version of the standard Pluggable Authentication Module (PAM) framework.
JAAS Reference:
http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html#AppendixA

SASL -- SASL is an Internet standard (RFC 2222) that specifies a protocol for authentication and optional establishment of a security layer between client and server applications. It provides pluggable authentication and security layer for network applications.
SASL Guide:
http://java.sun.com/j2se/1.5.0/docs/guide/security/sasl/sasl-refguide.html

JSSE -- JSSE provides a framework and an implementation for a Java language version of the SSL and TLS protocols.
JSSE Reference:
http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html

Java GSS-API -- Java GSS is the Java language bindings for the Generic Security Service Application Programming Interface (GSS-API). The only mechanism currently supported underneath this API on J2SE is Kerberos v5. Java GSS-API is used for securely exchanging messages between communicating applications.


解释:
以前的Java已经具备了codesource-based access controls,也就是根据code来自哪里,来自谁来决定access controls。 但是缺少根据是谁在执行code来决定access code的能力。 JAAS就是为Java提供这个能力的。 JAAS只用来干两件事:Authentication 和 Authorization。 而具体的形式,就是通过LoginModule的login结果,来确定要执行代码的人是谁(Authentication)和有没有全力来做(Authorization)。

AAS,SASL和GSS-API都是pluggable fashion的,和具体的Authentication方式是分离的。因此可以SASL + GSS-API + Kerberos, 也可以JAAS + Kerberos。

JAAS是对Java platform自身功能的加强。而SASL是一个Internet标准协议,Java SASL只是这个协议的一个种Java实现。这点上和JSSE, GSS-API是类似的,JSSE是SSL标准协议的Java实现, Java GSS-API 是对GSS-API的Java实现。
因此,在$JAVA_HOME/lib/security/java.security中有:
security.provider.2=com.sun.net.ssl.internal.ssl.Provider     #SunJSSE Provider
security.provider.5=sun.security.jgss.SunProvider         #SunGSS-API Provider
security.provider.7=com.sun.security.sasl.Provider        #SunSASL provider

使用哪个API,通常是由protocol的定义决定的。比如LDAP(Lightweight Directory Access Protocol)和IMAP(Internet Message Access Protocol)定义了要使用SASL。 而要实现SSL/TLS通信,则需要使用JSSE。当要用到Kerberos的时候,就需要Java GSS-API了。

另外,JSSE和GSS-API都是用来做通信加密的。不过JSSE是socket-based的API,而GSS-API是token-based的。也就是说JSSE只能使用socket,而GSS-API可以使用TCP sockets, UDP datagrams, 或者其他的。
对GSS-API和JSSE的更多比较参看这里:
http://java.sun.com/j2se/1.5.0/docs/guide/security/jgss/tutorials/JGSSvsJSSE.html


这4个通常还混合使用。比如最常见的模式是:SASL在客户端提供authentication, 而SASL的一种authentication mechanism就是GSS-API, 实现authentication最终通常会使用JAAS的LoginModule。 因此就形成了: SASL GSS-API/Kerberos V5 + LDAP的模式。这种模式常用来实现SSO(Single-Sign-On)。

Advanced Security Programming in Java 中列出了好几种组合模式:
http://java.sun.com/javase/6/docs/technotes/guides/security/jgss/lab/index.html#two

Link:
Java 6.0 Security的Document的总连接:
http://java.sun.com/javase/6/docs/technotes/guides/security/

Java Platform Security Architecture:
http://java.sun.com/javase/6/docs/technotes/guides/security/spec/security-spec.doc.html

Java Cryptography Architecture Reference & API:
http://java.sun.com/j2se/1.5.0/docs/guide/security/CryptoSpec.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics