David.Turing's blog

 

2006年3月16日

关于JVM的Thin Lock, Fat Lock, SPIN Lock与Tasuki Lock

     摘要: 关于JVM的Thin Lock、Fat Lock、SPIN Lock以及Tasuki Lock等概念  阅读全文

posted @ 2009-02-16 14:49 david.turing 阅读(1824) | 评论 (2)编辑 收藏

关于Lazy-UnLocking(Reservation Lock)对Java锁的性能优化

     摘要: 介绍Lazy-unLocking的概念,读这篇文章之前,建议先读一下我另外一篇Blog:http://www.blogjava.net/security/archive/2009/02/16/jvm_thin-lock_fat-lock__spin-lock_tasuki-lock.html  阅读全文

posted @ 2009-02-12 14:40 david.turing 阅读(2316) | 评论 (0)编辑 收藏

从java.lang.UnsupportedOperationException看WebLogic WS*协议栈的变迁

     摘要:   阅读全文

posted @ 2008-07-11 08:29 david.turing 阅读(1866) | 评论 (4)编辑 收藏

When ant build Spring 2.5.5 on Eclipse 3.4, We meet Ant compile rmic error - The task doesn't support the "base" attribute

     摘要:   阅读全文

posted @ 2008-07-07 16:28 david.turing 阅读(849) | 评论 (0)编辑 收藏

Problem about java.lang.LinkageError: loader constraints violated when linking javax/xml/namespace/QName class

     摘要: How to solve java.lang.LinkageError Problem  阅读全文

posted @ 2008-07-06 18:41 david.turing 阅读(1730) | 评论 (0)编辑 收藏

[原创]Hibernate的Antlr在Weblogic中产生Jar冲突的历史缘故以及解决办法

     摘要: WebLogic + Hibernate 包冲突看代码重构的重要性  阅读全文

posted @ 2008-07-04 23:24 david.turing 阅读(3173) | 评论 (1)编辑 收藏

[原创]从中间件厂商的角度看EJB3标准

     摘要:   阅读全文

posted @ 2008-06-29 22:28 david.turing 阅读(1753) | 评论 (1)编辑 收藏

【转载BSA】研究显示亚太地区在降低软件盗版方面取得稳定进展,中国盗版情况持续改善

     摘要: 软件盗版不但对产业造成极为负面的影响,还制约了技术公司创造新工作岗位和对新
技术的创新能力,损害了本地分销商和服务公司的利益,降低了政府税收,增加了网络犯
罪和安全问题的风险。2008 年1 月IDC 发布的降低软件盗版对经济影响的研究报告显
示,如果中国在未来的四年中,将PC 软件盗版率降低10 个百分点,将会带来355,000
个新的就业机会、205 亿美元的经济增长和16 亿美元的税收收入。  阅读全文

posted @ 2008-06-06 21:02 david.turing 阅读(461) | 评论 (0)编辑 收藏

将Spring用于高并发环境的隐忧

     摘要: Spring一个关于Lock Contention的Bug引起我对Spring代码质量的忧虑  阅读全文

posted @ 2008-04-19 09:47 david.turing 阅读(3892) | 评论 (20)编辑 收藏

如何理解嵌套事务(Nested Transaction)

     摘要: 介绍nested transaction的概念  阅读全文

posted @ 2008-03-04 12:38 david.turing 阅读(2760) | 评论 (4)编辑 收藏

Oracle收购BEA——如何看待J2EE中间件的价值

Oracle终于收购了BEA了
http://www.oracle.com/bea/index.html
http://biz.yahoo.com/ap/080116/oracle_bea.html

新一轮收购,其实最值得关注的是WebLogic/Tuxedo两个拳头产品,而作为一直缺乏中间件领头产品的Oracle公司,这一次又重新开始瓜分市场,微软/IBM/SAP都会面临直接的强有力的挑战。

整个事件中,对于所有JavaEE开发者,无疑是WebLogic。
如果说,Oracle是最优秀的数据库产品,我觉得,WebLogic绝对是铁定最优秀的J2EE中间件服务器(对WAS6.1,用户普遍认为还是WebLogic 9/10更强大)。
有很多人认为WebSphere会是一个挑战者,这里面含有较多的商业因素,从技术含量上,从稳定性,可靠性和关键企业用户覆盖上,WebLogic的价值远胜于WebSphere。在中国,WebLogic关键企业用户要远胜于WebSphere。
Oracle的中间件定义范畴非常广,这次的收购,在J2EE的领域,将会是新一场中间件标准的全面对抗,如果考虑到Oracle数据库曾经完胜了IBM的DB2一回,这一次,在J2EE中间件上,Oracle又一次是IBM抛离在脑后了。

在JavaEE中间件标准上,现在,Oracle有了Sibel,PeopleSoft,  BEA,在SOA Solution的完整性上,完全可以PK IBM了。

大部分人关注,现在的IT企业,架构越来越复杂,甚至SOA,曾经一度成为我们未来最重要的IT新概念,而J2EE本身,中间件本身,有些人甚至认为不再重要了,因为SOA是面向服务的,本身并不依赖于特定的J2EE中间件。
其实,明眼人还是能看出,所有的IT概念背后,IT的基础设施仍然是IT生态链中的关键组成部分,实施一个SOA的项目,你必须购买主机硬件,购买OS,购买中间件,然后最后才在其上开发你的SOA架构。
现在,SOA对抗,虚一点看,好像是IT战略的范畴,实一点看(从技术、资金),无非是平台之争。这一次Oracle收购BEA,足以让国人重新审视J2EE中间件的巨大价值和重要地位,WebLogic,目前,一个被IT500强公认为最优秀的J2EE中间件服务器,将会收购事件背后的其中一个主要的推动因素。无论SOA是如何成为第三波IT产业革命的重要推动力,J2EE中间件平台之争就犹豫当年的OS、浏览器之争那样激烈,是每个企业决策层实施SOA的时候必定考虑到的因素。


posted @ 2008-01-16 22:39 david.turing 阅读(3692) | 评论 (11)编辑 收藏

Eclipse+Ant开发EJB的三个习惯

     摘要: Eclipse上开发EJB的Ant环境设置的三个习惯  阅读全文

posted @ 2007-11-19 14:32 david.turing 阅读(1951) | 评论 (1)编辑 收藏

关于配置Weblogic的NodeManager服务

     摘要: 介绍如何配置Weblogic的Nodemanager服务  阅读全文

posted @ 2007-09-04 15:20 david.turing 阅读(4023) | 评论 (2)编辑 收藏

关于Weblogic GBK/GB2312/UTF-8乱码的问题

最近,频繁听到很多关于Weblogic乱码的问题,
其实,都是一些个人认为比较容易避免的问题。

1,如果是开发阶段的乱码,比如从屏幕上看到了一堆乱七八糟的编码
尝试在weblogic.xml文件的<jsp-descriptor>部分加入下面的描述:

  <jsp-descriptor>
       <jsp-param>
             <param-name>compilerSupportsEncoding</param-name>
             <param-value>true</param-value>
         </jsp-param>
         <jsp-param>
             <param-name>encoding</param-name>
               <param-value>GBK</param-value>
         </jsp-param>
  </jsp-descriptor>

这样,起码会告诉Weblogic容器你的应用含有中文,比如JSP页面,而它会善待你的JSP中的中文。


2,如果你是在Windows上面开发,然后部署到其他平台,比如IBM AIX上,则你要注意encoding的问题,
即文件的Encoding。比如,通常来说,各位都是Eclipse之徒,默认Eclipse上面的文件格式是基于本地的字符集,
即GBK,你是用GBK存储这些文件,甚至打包后想放到AIX上运行是不行的,解决方法太简单了,
JAVA_OPTIONS=-Dfile.encoding=GBK
告诉AIX上的Weblogic上的IBM JVM,默认文件encoding不是utf-8,是GBK, 即可。

上面两种方法,前者是针对中文编码的识别问题,后者是针对文件编码的识别问题,两者是不一样的。
在Java中,任何的内容都是以Unicode存在的,看Java程序中的内存,全部String都是Unicode,另外一个问题是,
假定这些String存储成文件,则要考虑Unicode如何写入到文件中,通常用的都是utf-8编码来存储。


posted @ 2007-08-16 22:53 david.turing 阅读(2661) | 评论 (0)编辑 收藏

关于Weblogic 10下开发WebService的配置问题

在Weblogic 10下面,weblogic.jar被拆分了,其中包括一些javax的接口被分解到api.jar去
所以,你发现自己的WebService无法解释下面这些引用,请务必加入api.jar。
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebParam;
import javax.jws.WebService;


posted @ 2007-08-16 15:18 david.turing 阅读(2024) | 评论 (0)编辑 收藏

国内第一例自由软件盗用事件(Captcha开源社区的Captchio)

     摘要: 国内第一例自由软件盗用事件(Captcha开源社区的Captchio软件恶意盗用行为)  阅读全文

posted @ 2007-05-21 19:03 david.turing 阅读(3633) | 评论 (15)编辑 收藏

发布一个简易的EclipseDos Plugin(6KB)

     摘要: 发布一个简单易用的Dos插件,可以直接根据Java的package进入到Dos的相关路径,只有6KB大小  阅读全文

posted @ 2007-05-09 11:51 david.turing 阅读(2147) | 评论 (10)编辑 收藏

在重庆跟几个流氓纠缠,借用粤语脱身

     摘要:   阅读全文

posted @ 2007-04-03 21:28 david.turing 阅读(972) | 评论 (4)编辑 收藏

Portal技术最新动态与企业门户开发经验交流(广州User Group活动)

     摘要: 2007年4月7日广州User Group活动
主 题:Portal技术最新动态与企业门户开发经验交流
时 间:2007年4月7日下午1:00到6:00
地 点:广州天河北路468号
嘉逸国际酒店(百佳超市对面) 三楼嘉逸宴会厅

随着信息化建设的逐渐深入,软件技术的不断创新,Portal技术已经成为企业信息化建设的一个重要组成部分。Portal是企业现有应用与新应用的集成节点,使用户能够与人员(People)、内容(content)、应用(Application)和流程(Processes)进行个性化的、安全的、单点式的互动交流。Portal现在已经成为企业最关注的领域之一,是实现企业整合的第一步。   阅读全文

posted @ 2007-03-29 22:08 david.turing 阅读(3847) | 评论 (10)编辑 收藏

BEA成都分公司招聘售前技术工程师一名

     摘要:   阅读全文

posted @ 2007-03-23 10:46 david.turing 阅读(1396) | 评论 (0)编辑 收藏

已经申请了Google Hosted Mail

用中国IP申请一直不行,今天无意中在公司的美国VPN线路上, 申请, 居然通过, 无话可说.
有需要使用gzug.org邮件的请跟我联系.

电子邮件 - http://mail.google.com/a/gzug.org/
日历 - http://www.google.com/calendar/a/gzug.org

另外, 发现google的Page Maker也很好用, 自己申请一个Google Hosted来写
Blog很爽啊: )

http://www.gzug.org/

posted @ 2007-03-08 09:40 david.turing 阅读(1358) | 评论 (9)编辑 收藏

针对Weblogic的JDBC写法大全

     摘要: 最近收集到的JDBC写法大全  阅读全文

posted @ 2007-03-01 08:05 david.turing 阅读(3123) | 评论 (0)编辑 收藏

微软开始使用Google广告了

     摘要: 连Microsoft都在用Google广告了!  阅读全文

posted @ 2007-02-02 17:43 david.turing 阅读(2492) | 评论 (0)编辑 收藏

提供一个Dos/Bash到某个指定目录的鼠标右键的快捷方式

     摘要: 创建dos/bash的简单右键快捷方式  阅读全文

posted @ 2007-02-01 16:54 david.turing 阅读(2104) | 评论 (1)编辑 收藏

PriceOfYinXiangDongShan

单价         套数                  房号                   总价         日期
------------- -------------------- -------------------- -------------- ----------------------------
8420.86851628 1 1408 767899.0000 2006-05-25
8414.60879080 1 2007 461373.0000 2006-05-25
8224.28073668 1 1901 826129.0000 2006-05-25
7152.41574871 1 1605 655805.0000 2006-05-25
8184.21105027 1 1801 822104.0000 2006-05-25
8306.08572363 1 2209 761585.0000 2006-05-25
8264.34046789 1 2001 830153.0000 2006-05-26
8410.43692032 1 2206 752650.0000 2006-05-26
8364.51365281 1 2008 762760.0000 2006-05-26
8204.24388639 1 1608 748145.0000 2006-05-26
8334.47018055 1 1807 456979.0000 2006-05-26
8915.47395109 1 2002 1090095.0000 2006-05-26
8294.40087543 1 1707 454782.0000 2006-05-29
8945.53038357 1 2102 1093770.0000 2006-05-29
7933.76913621 1 1806 709993.0000 2006-05-29
8079.42756881 1 1708 736763.0000 2006-05-30
8013.91216895 1 2006 717165.0000 2006-05-30
8053.97889915 1 1603 984760.0000 2006-05-30
8092.45113273 1 1903 989464.0000 2006-05-30
7873.67215617 1 1909 721937.0000 2006-06-02
8898.69503235 1 2608 811472.0000 2006-06-02
7834.22401570 1 1609 718320.0000 2006-06-03
8534.81670618 1 2407 467964.0000 2006-06-03
8951.41345978 1 2607 490806.0000 2006-06-03
8330.19546904 1 2103 1018533.0000 2006-06-03
9286.57669159 1 2107 509183.0000 2006-06-03
7630.43952448 1 1405 699635.0000 2006-06-05
9400 1 1907 515402.0000 2006-06-05
8573.11108674 1 2408 781782.0000 2006-06-05
8000.88825529 1 1508 729601.0000 2006-06-06
8056.89866688 1 1503 985117.0000 2006-06-07
8919.78843698 1 2207 489072.0000 2006-06-07
8188.49178695 1 1601 822534.0000 2006-06-07
9541.30950209 1 2307 523150.0000 2006-06-10
8284.38425265 1 1808 755453.0000 2006-06-12
8646.58038825 1 2401 868549.0000 2006-06-12
8561.29855918 1 1407 469416.0000 2006-06-16
7662.15736541 1 2404 777096.0000 2006-06-16
8327.91972804 1 1908 759423.0000 2006-06-17
9939.42913224 1 2502 1215294.0000 2006-06-22
9642.88868896 1 1702 1179036.0000 2006-06-27
8730.00497760 1 2101 876929.0000 2006-06-27
9349.56244377 1 2202 1143171.0000 2006-06-27
9421.73483934 1 2108 859168.0000 2006-06-29
8117.63551096 1 2409 744306.0000 2006-06-30
7797.77511178 1 1505 714978.0000 2006-07-04
8299.82824895 1 2003 1014820.0000 2006-07-05
8846.39731741 1 1602 1081649.0000 2006-07-05
8927.37384476 1 1802 1091550.0000 2006-07-05
8708.90651836 1 2203 1064838.0000 2006-07-05
9129.81107385 1 2402 1116302.0000 2006-07-05
8078.39459046 1 1809 740708.0000 2006-07-05
7996.17188352 1 2009 733169.0000 2006-07-06
8099.06134763 1 1606 724785.0000 2006-07-06
7698.32042752 1 2005 705859.0000 2006-07-06
8048.23863016 1 1705 737943.0000 2006-07-07
8388.32271762 1 2406 750671.0000 2006-07-08
9050.34354891 1 2109 829826.0000 2006-07-10
7814.03642709 1 1905 716469.0000 2006-07-15
8704.54793325 1 1709 798120.0000 2006-07-18
7613.96008288 1 1805 698124.0000 2006-07-20
8307.39747457 1 1406 743429.0000 2006-07-20
9630.43264905 1 1902 1177513.0000 2006-07-21
8548.44116661 1 1506 765000.0000 2006-07-22
8933.39513578 1 2309 819103.0000 2006-07-22
9585.77694922 1 2308 874127.0000 2006-07-31
7967.82685860 1 2104 808097.0000 2006-08-03
8906.52197622 1 2509 816639.0000 2006-08-05
9345.65455450 1 2201 938771.0000 2006-08-07
8884.78042239 1 2106 795099.0000 2006-08-09
7808.04886029 1 2105 715920.0000 2006-08-12
8512.27430238 1 1607 466728.0000 2006-08-16
9015.21957760 1 2506 806772.0000 2006-08-16
8439.13185734 1 1311 773784.0000 2006-08-18
8614.89802595 1 1509 789900.0000 2006-08-21
8559.20116724 1 1507 469301.0000 2006-08-22
9706.58398686 1 2507 532212.0000 2006-08-22
7821.63265306 1 1701 785683.0000 2006-08-23
9010.86938742 1 2303 1101759.0000 2006-08-23
9043.23388088 1 2306 809279.0000 2006-08-23
9555.15955696 1 2508 871335.0000 2006-08-24
9378.25783972 1 2301 942046.0000 2006-08-28
7967.39301912 1 1704 808053.0000 2006-09-01
8976.08760577 1 1401 901648.0000 2006-09-02
8032.60988112 1 2305 736510.0000 2006-09-04
9049.89582191 1 2208 825260.0000 2006-09-04
8918.02568087 1 1803 1090407.0000 2006-09-08
8083.33515105 1 2205 741161.0000 2006-09-13
9205.92132166 1 2403 1125608.0000 2006-09-14
9238.87298601 1 2503 1129637.0000 2006-09-20
8006.44843226 1 1604 812014.0000 2006-09-20
8411.41786629 1 1804 853086.0000 2006-09-28
9872.45395719 1 2501 991688.0000 2006-10-09
7964.15894300 1 1504 807725.0000 2006-10-12
9943.45301382 1 1502 1215786.0000 2006-10-18
9221.73877484 1 1703 1127542.0000 2006-10-24
8183.14928022 1 1404 829935.0000 2006-10-28
8534.81670618 1 2407 467964.0000
8512.27430238 1 1607 466728.0000
7698.32042752 1 2005 705859.0000
1 2601
1 2405
8388.32271762 1 2406 750671.0000
8048.23863016 1 1705 737943.0000

某些价格是按揭, 某些不是

posted @ 2007-01-30 16:49 david.turing 阅读(116) | 评论 (0)编辑 收藏

[原创] Pass SSL Certificate to Weblogic Cluster through Apache Proxy under SSL

     摘要: This Paper will introduce how to pass certficate to Weblogic Cluster
through Apache Proxy under SSL.
Before you read this paper, please read another blog of mine( but not
necessary).

<>
http://www.blogjava.net/security/archive/2007/01/07/WeblogicClusterWithApacheProxyUnderSSL.html  阅读全文

posted @ 2007-01-13 19:19 david.turing 阅读(3324) | 评论 (0)编辑 收藏

[原创]Apache Proxy with Weblogic Cluster under SSL

     摘要: 如何配置Apache与Weblogic集群走SSL协议  阅读全文

posted @ 2007-01-07 14:34 david.turing 阅读(4766) | 评论 (2)编辑 收藏

发布一个简易版本的SecureXRCP

     摘要: 发布一个简易的SecureXRCP,方便不使用Eclipse的管理员去处理证书库以及产生/验证XML数字签名以及数字水印。  阅读全文

posted @ 2007-01-07 11:16 david.turing 阅读(2573) | 评论 (3)编辑 收藏

传说中的88888的车牌

IMG_0088.JPG

posted @ 2007-01-02 10:06 david.turing 阅读(1340) | 评论 (1)编辑 收藏

安装测试Apache Proxy For Weblogic Cluster笔记

请在下面的配置文档中置换以下三个字符串

BEA_HOME=D:\bea
APACHE_HOME=D:\Apache2
WEBLOGIC_CLUSTER=192.168.102.3:8001,192.168.102.4:8001,192.168.102.4:8003
 
 
配置文档:
1,Download Apache 2.0
http://httpd.apache.org/download.cgi

2,安装Apache 2.0, 使用默认的80默认端口
Copy Weblogic的so到Apache目录
源位置在:%BEA_HOME%\weblogic81\server\bin\mod_wl_20.so
目标位置在:%APACHE_HOME%\modules

注意改so文件已经包含了LoadBalence算法,可以通过Weblogic的Cluster去提供权重参数反馈给mod_wl_20.so,
这样, Apache知道如何Balance Request到Cluster中处理能力更强的服务器。

修改httpd.conf配置文件(%APACHE_HOME%\conf\httpd.conf),让apache加载weblogic提供的For Apache的Plugin——
LoadModule weblogic_module mod_wl_20.so
 
3,配置Apache指向Weblogic集群
让Apache遇到任何请求,都转发给Weblogic
<IfModule mod_weblogic.c> 
WebLogicCluster %WEBLOGIC_CLUSTER% 
MatchExpression *.*
</IfModule>

4,集群测试
在weblogic集群上部署defaultWebApp
直接访问http://localhost/defaultWebApp
Apache即可重订向用户到Weblogic集群去。

建议:对于静态资源,我们可以配置让Apache去读取并解析,无须Proxy到Weblogic集群去。

posted @ 2006-12-28 22:58 david.turing 阅读(2981) | 评论 (1)编辑 收藏

Java新闻2006,Dec 21

BEA News

BEA Systems' Guardian Offers Pre-emptive Support -- eChannelLine.com
December 22, 2006 -- BEA Systems Inc. plans to release its BEA Guardian evaluation version followed by a general availability release. Guardian represents a departure from the traditional support model employed by the enterprise software industry and is designed to reduce the cost of reactive and proactive support services for organizations, officials said. Stuart Charlton, head enterprise architect for BEA Systems Canada, said his company is offering pre-emptive support as a means of analyzing the customer's computing environment and comparing it to BEA's knowledge base. The end result is Guardian is designed to detect problems before they occur and in turn help lower daily IT operational costs.

BEA Systems' Guardian Offers Pre-Emptive Support -- eChannelLine.ca
December 22, 2006 -- BEA Systems Inc. plans to release its BEA Guardian evaluation version followed by a general availability release. Guardian takes support services from a traditional break-fix model to a pre-emptive model, designed to help customers running business critical applications, given high availability is no longer a strategic goal but a tactical necessity in the modern world. "We're seeing a drive to reduce the diagnosis and time to resolution costs in the enterprise data centre," said Stuart Charlton, head enterprise architect for BEA Systems Canada. "This is another way of capturing knowledge in a machine-readable form and help resolve issues before they become problems."
 


--------------------------------------------------------------------------------
 
JBoss News

Red Hat 3Q Profit Drops But Beats Wall Street Expectations -- San Jose Mercury News.com
December 22, 2006 -- Stock-compensation expenses cut into profits for the second consecutive quarter for Red Hat Inc., but the company again exceeded analysts' expectations. The company's second-quarter profit dropped 34 percent on stock-compensation expenses. But company shares surged nearly 14 percent in after-hours trading Thursday. "Our brand and our reputation is world-recognized," Red Hat Chairman Matthew Szulik said after markets closed. "The continued innovation in the next quarter will allow us to compete successfully."

Red Hat Earnings Shrug Off Oracle Threat -- ZDNet.com
December 21, 2006 -- Red Hat's net income subsided in its most recent quarter, but revenue increased as the Linux seller shrugged off the arrival of Oracle as a direct competitor. For the quarter ended November 30, the company's net income was $15.5 million, down 37 percent compared with the same period a year ago. But its revenue increased 45 percent to $105.8 million. The net income of 14 cents per share, excluding various charges like stock option expenses, beat the average expectation of 12 cents per share predicted by analysts surveyed by First Call. "It looks like the world is not coming to an end for you guys after all," said Merrill Lynch analyst Kash Rangan shortly afterward.

Customer Backlash Against Oracle's Buggy Linux Product? -- SeekingAlpha.com
December 22, 2006 -- Mark Murphy, an analyst for First Albany, asked "So, I guess the question is, is it realistic to think that Oracle is just going to ride this experiment into the ground, or would you expect them to possibly withdraw their offering from the marketplace?" Matthew Szulik, CEO Red Hat, responded "we're focused on the success of our customers. We are focused on expanding the opportunity for open source software through initiatives like OLPC with RHEL 5, RHN 2.0, the expanding JBoss middleware stack, and I have to be frank with you, I don't spend a whole lot of time thinking about the operational issues and the Oracle operating system product."
 


--------------------------------------------------------------------------------
 
IBM News

Building The SOA Assembly Line -- RedOrbit.com
December 22, 2006 -- RQI is just one of a hundred such reusable SOA components that IBM has built and that are now being used to build new solutions from the ground up for each client. The components are part of a larger effort at IBM to leverage the company's deep application development and IT services expertise to create a storehouse of reusable assets that can be used with customers of all stripes. "What we are really doing by building reusable assets is allowing customers to build their solutions that much quicker and become very flexible," says Brett MacIntyre, IBM's vice president for Composite Services Development.

 
SAP News

SAP Fills Out 2007 Agenda -- InternetNews.com
December 22, 2006 -- At the top of SAP's agenda is the SOA initiative, its new Duet software for Microsoft Office users, and an enterprise search service still in development. SAP's answer is to provide a standard platform based on its NetWeaver software on which to allow customers, ISVs, and others innovate. While most platform vendors let customers innovate to some degree, analyst Joshua Greenbaum credits SAP for running more forcefully with the idea. "Some of SAP's competitors are known for predatory partnerships, where you also have to compete with them, and I think SAP used to be more like that too," Greenbaum, who is with Enterprise Applications Consulting, told internetnews.com.
 


--------------------------------------------------------------------------------
 
Microsoft News

Key Developer Quits Novell Over Microsoft Patent Pact -- eWeek.com
December 21, 2006 -- Jeremy Allison, a leading Samba developer and well-known open-source speaker, has decided to leave Novell because of his objections to the Microsoft/Novell patent agreement. In his public letter of resignation, Allison said, "This has been a very difficult decision, but one I feel I have no choice but to make. My main issue with this deal is I believe that even if it does not violate the letter of the license it violates the intent of the GPL license the Samba code is released under, which is to treat all recipients of the code equally."
 


--------------------------------------------------------------------------------
 
Industry News

Wall Street Beat: The Year Ahead -- InfoWorld.com
December 22, 2006 -- Get set for some surprises. With 12 months of moderate expansion expected in the global IT arena, vendors will have to get creative in 2007 to maintain the kind of growth investors want. Tech companies, however, are under pressure. Worldwide IT spending will increase by 6.6 percent in 2007, according to IDC. This is slightly better than the 2006 increase of 6.3 percent but nowhere near the double-digit levels of the dot-com boom. "You will see major vendors performing unnatural acts," quipped Frank Gens, senior vice president of research at IDC.
 


--------------------------------------------------------------------------------
 
Blog Monitoring

LEGO Blocks And SOA: Is The Singularity Near? -- ZDNet.com
December 21, 2006 -- Joe McKendrick questions whether LEGOs are becoming more like our IT systems, versus the other way around.

Auto-Generated Services Okay In Model-Driven SOA -- ZDNet.com
December 21, 2006 -- Joe McKendrick writes about how auto-generating service does not invalidate reuse or SOA: the secret sauce and key IP for businesses is the data/business models.

C With NetBeans On Linux ... Check It Out! -- Weblogs.Java.net
December 21, 2006 -- Joerg Plewe writes about how JDK6, NetBeans 5.5 and the new C/C++ development pack is smooth and very user friendly.

BEA Systems Maintains High Ranking In Application Server Software Platform Market In Asia Pacific -- Egoboss.com
December 21, 2006 -- (BEA MENTION) -- Carl Griffith writes about how BEA is a leader in the Application Server Software Platform market in Asia-Pacific region and its SOA has risen to the forefront.

 


--------------------------------------------------------------------------------
 
Feature Story

The Traditional ESB Gets Weaved Into An SOA Fabric -- SearchWebServices.com
December 21, 2006 -- In a sign of how quickly things change, the "traditional" enterprise service bus is undergoing an evolution to stay current with the demands of the service-oriented architecture, morphing from an integration/messaging tool to an infrastructure offering that includes tools for business process management (BPM) and governance, analysts say.


The introduction this week of webMethods Fabric 7.0 indicates how much the ESB product category has grown from its original integration backbone role.


"The thing that we see in webMethods Fabric 7.0 is a really straightforward development environment for building composite applications in an SOA fashion," said Bill Swanton, vice president of research for AMR Research, Inc. He said the new product integrates all the tools historically linked to integration including the original enterprise application integration (EAI) technology as well as ESB, but now includes BPM, business activity monitoring (BAM), registry/repository and governance capabilities.


Outmoded as EAI may appear to be in an SOA world, it is still important to support the legacy technology, which is still in place in many corporations, said Peter S. Kastner, vice president enterprise integration for the Aberdeen Group.


"We found almost nobody who is willing to abandon their investments in EAI just to buy an ESB to say that they own one," he said. He cited webMethods as an original EAI company that has successfully made the transition into the SOA world while providing a bridge back to old integration technology. His research of IT departments this year disproved his own belief that the old integration vendors were doomed.


"My hypothesis going into the year was that the EAI companies would take it on the chin," Kastner said. "The reality is the vast majority of their customers are fairly easily connecting SOA via adapters to their EAI fabric or infrastructure."


Kastner and Swanton agree that adding the newer technology, especially BPM, is important to the evolution of the ESB technology webMethods is packaging under its Fabric brand.


Swanton said many of the other ESB vendors are still trying to put together a comprehensive toolset that will serve the needs of both business analysts and developers. The overall ESB technology is moving to include BPM so that developers can work with business analysts on the applications for the business processes, he said.


The BPM technology is important, Kastner said, because based on his research big business is embracing it in a big way. "We're seeing at this point that roughly 50 percent of the Global 5000 are actively engaged in business process management development." He noted that webMethods is not alone in integrating BPM into its ESB technology.


"You should note that Tibco has invested heavily in BPM over the last several years," he said. "Fiorano also beefed up their ESB product significantly in the BPM space in the last six months."


ESB evolution requires a new definition and perhaps even a new name, said Marc Breissinger, CTO at webMethods Inc., noting that the industry is beginning to embrace the term "fabric," which his company and some others use in their product branding.


From webMethod's point of view, the CTO said, the definition of ESB has expanded from a set of categorical definitions of features and functionality to a general category of technology that solves business problems.


"The focus of webMethods Fabric 7.0 coming out this week has to do with the evolution of business process management systems in the context of SOA and classic integration scenarios," Breissinger said. "What we have seen is a convergence of the straight-through processing style automated BPM along with the more human-centric approaches to business process management, or what is commonly referred to as workflow, into a coherent whole, along with business activity monitoring that also needs to be delivered by the BPMS, as well as UI development."


The term fabric has become the umbrella for all the added tools and technologies. It is also used by the Burton Group, which uses terms such as middleware fabric and Web services fabric in discussing application integration using the service-oriented approach.


Breissinger said he isn't wild about the fabric terminology, but it appears to be the best way to describe the holistic approach to combining ESB with BPM and other technology for measuring, modeling and implementing SOA.


"In the past before we got into the BPM space, we were talking about integration backbones," the webMethods' CTO said in providing a brief history of terms. "Then we talked about services buses. In a sense the fabric is the same concept taken one step further to include the business process management and the analytics and the composite application development capabilities to give you that full system building infrastructure versus a pure bus or backbone."
 

posted @ 2006-12-26 09:04 david.turing 阅读(1048) | 评论 (0)编辑 收藏

引领下一代IDE发展的Workshop——将全面集成Java,PHP,Flex,Ruby到Weblogic

     摘要: 在2006 BEAWorld ,Workshop团队向Java开发者展示了其强大的Workshop IDE功能,Workshop宣布支持PHP, Flex开发,开发者能够在Weblogic Platform上部署PHP和Flex应用,在未来,Workshop还会支持Ruby等语言的集成开发。   阅读全文

posted @ 2006-12-13 22:58 david.turing 阅读(2520) | 评论 (6)编辑 收藏

关于JVM的一些常用技术

Thread Dump:
1,Solaris OS
<ctrl>-’\’ (Control-Backslash)
 kill -QUIT <pid>

2, Linux
Kill -3 PID 
PID通过下面方法获取
ps -efHl | grep 'java' **. **

3,Windows
直接对MSDOS窗口的程序按Ctrl-break

 

posted @ 2006-12-12 22:28 david.turing| 编辑 收藏

PGP技术与网络实名制的思考

     摘要: PGP技术与网络实名制的思考  阅读全文

posted @ 2006-11-25 11:21 david.turing 阅读(4150) | 评论 (4)编辑 收藏

获取PDABase.com所有下载文件的HTTPClient代码

     摘要: 最近追Friends(老友记),想在PPC上看,顺便编写了一个HTTPClient的Sample,可以获取PDABase.com的所有下载链接,希望对PDA爱好者有所帮助,可以自己生成Flashget的Task,一次性Download整个网站。  阅读全文

posted @ 2006-11-13 23:18 david.turing 阅读(3019) | 评论 (7)编辑 收藏

[原创]国内大部分的USBKey通过B/S方式(CAPICOM)产生数字签名的严重安全漏洞

     摘要: 国内所有的USBKey通过CAPICOM在Web页面产生数字签名的严重安全漏洞  阅读全文

posted @ 2006-11-13 11:06 david.turing 阅读(7516) | 评论 (10)编辑 收藏

SecureX Eclipse Plugin Alpha2发布

     摘要: Alpha2,支持向导创建KeyStore;支持创建KeyPair;修正了Alpha1的Editor没有Titile等Bug  阅读全文

posted @ 2006-11-11 13:56 david.turing 阅读(5641) | 评论 (13)编辑 收藏

发布SecureX Eclipse Plugin 2.0.0 alpha版本

     摘要: 原先是一个Keytool Eclipse Plugin功能的SecureX,经过了一些小扩展,集成了Java各种安全功能,包括XML数字签名,数字印章,CSP,USBKey等开源技术  阅读全文

posted @ 2006-11-08 16:45 david.turing 阅读(2996) | 评论 (0)编辑 收藏

[转载]推荐一下CSDN《程序员》的《开源大本营》

     摘要: 推荐仅仅因为自己编写了安全那部分:) 时间很紧,如有纰漏,请指教  阅读全文

posted @ 2006-11-06 08:54 david.turing 阅读(1812) | 评论 (3)编辑 收藏

用JSR181驱动SpringSide Web Services

     摘要: 关于如何应用XFire JSR181到SpringSide的几个设想  阅读全文

posted @ 2006-10-31 09:47 david.turing 阅读(2590) | 评论 (0)编辑 收藏

PHP与CAS做SSO

     摘要: 关于PHP与CAS做Web SSO,使用PHPCAS  阅读全文

posted @ 2006-10-26 08:04 david.turing 阅读(4039) | 评论 (8)编辑 收藏

PGP论坛开始启用(pgp.sourceforge.net/forum)

http://www.pgp.org.cn
请共享你的公钥

http://pgp.sourceforge.net/forum

欢迎探讨PGP技术

posted @ 2006-10-18 20:22 david.turing 阅读(3946) | 评论 (0)编辑 收藏

Federate Portal,面向SOA的Portal

     摘要: 探讨一下Federate Portal概念以及WSRP技术  阅读全文

posted @ 2006-10-16 22:25 david.turing 阅读(2026) | 评论 (4)编辑 收藏

Yale CAS as an Acegi Client in SpringSide

     摘要: 如何将SpringSide配置成一个基于Acegi的CAS Client
环境是CAS Server 3.0+Acegi 1.0+Tomcat  阅读全文

posted @ 2006-10-15 23:53 david.turing 阅读(5742) | 评论 (2)编辑 收藏

BEA广州UserGroup招募Speaker

第四次广州UserGroup开源技术研讨会紧张筹备中,初定10月21日下午在广州亚洲国际大酒店举行。
主题是:SOA and Agile
ThroughtWorks的高级咨询顾问Brinkey将回到广州为大家分享SOA与敏捷开发的经验
大家对SOA有兴趣的请发邮件联系我。
邮件:david.turing@bjug.org

BEA广州UserGroup 地址:http://dev2dev.bea.com.cn/bbs/forum.jspa?forumID=29304&start=0
BEA广州UserGroup QQ群:30434538

posted @ 2006-10-08 13:06 david.turing 阅读(1561) | 评论 (7)编辑 收藏

[原创] SSO(Single Sign-on) in Action(上篇)

     摘要: 介绍单点登陆(SSO)的原理与实践经验,包括Yale CAS, Kerberos SPNEGO, SAML SSO等方式,并深入SSO协议与原理,最后会介绍各种SSO的基本配置方法。  阅读全文

posted @ 2006-10-02 16:27 david.turing 阅读(19725) | 评论 (26)编辑 收藏

灵感之源的Guardio/Defendio究竟值多少钱?

     摘要:   阅读全文

posted @ 2006-09-29 21:04 david.turing 阅读(2280) | 评论 (9)编辑 收藏

Tomcat/Weblogic在SSL握手中,IE提交证书窗口为空的问题

最近有网友在Dev2dev问,
访问https://yourmachine:8843/webapp的时候,客户端提交了空的证书窗口,如下图所示
no_certificate_for_ssl.gif

如果使用的是Tomcat,则需要检查JDK/Jre/lib/security下的cacerts是否包含了客户端用户
的Key所对应的CA证书,如果没有,则客户端出现上述窗口,因为,服务器端不
会不信任为客户端的Private Key所签名的ca证书!

如果使用Weblogic,需要要区分Use Custom Indentity和Use Java Keystore两种方式,
前者,往Weblogic的JKS导入客户端PK所对应的CA证书(链),后者,检查
Jre/lib/security的cacerts,做法跟上面一样。

posted @ 2006-09-27 11:38 david.turing 阅读(2332) | 评论 (1)编辑 收藏

发现GDCA USBKey(电子钥匙)的CSP数字签名实现存在缺陷

     摘要: 怀疑GDCA的签名实现存在缺陷  阅读全文

posted @ 2006-09-26 17:33 david.turing 阅读(3166) | 评论 (5)编辑 收藏

9月23日成都WS-Security演讲内容稿

     摘要: 在网上收集了不少WS-Security的资料,组织了一下成都BEA UserGroup之WS-Security演讲的PPT初稿,不知道是否有遗漏,欢迎指点。  阅读全文

posted @ 2006-09-22 01:03 david.turing 阅读(4649) | 评论 (4)编辑 收藏

Java安全概述

     摘要: 总结Java安全的5个重要方面  阅读全文

posted @ 2006-09-21 00:39 david.turing 阅读(4794) | 评论 (2)编辑 收藏

中国应该有自己的PGP群体

     摘要: PGP共享平台已经建立(www.pgp.org.cn),拥有一把PGP钥匙是一件很Cool的事情,保护Privacy就从现在做起  阅读全文

posted @ 2006-09-15 00:38 david.turing 阅读(1927) | 评论 (4)编辑 收藏

SourceForge Shell/Web使用指南

     摘要: 如何使用Winscp和puttygen连接Sourceforge的shell service/web  阅读全文

posted @ 2006-09-11 21:52 david.turing 阅读(1594) | 评论 (0)编辑 收藏

解释CAS Logout问题

     摘要: Explain why CAS can't logout? 解释CAS SSO一个很重要的问题  阅读全文

posted @ 2006-09-07 22:16 david.turing 阅读(4858) | 评论 (3)编辑 收藏

Yale CAS异常问题总结(2)Unable to validate ProxyTicketValidator之unable to find valid certification path to requested target

     摘要: edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator
unable to find valid certification path to requested target  阅读全文

posted @ 2006-09-06 09:08 david.turing 阅读(5065) | 评论 (3)编辑 收藏

Yale CAS异常问题总结(1)Unable to validate ProxyTicketValidator之HTTPS hostname wrong: should be.....

严重: edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator [[edu.yale.its.tp.cas.client.ProxyTicketValidator prox
yList=[null] [edu.yale.its.tp.cas.client.ServiceTicketValidator casValidateUrl=[https://192.168.1.111:8443/cas/proxyValidate] ticket=[ST-0-9h7Mx5HK3pfsdxRv
MD3y] service=[http%3A%2F%2F192.168.1.222%3A8080%2Fservlets-examples%2Fservlet%2FHelloWorldExample] renew=false]]]


这个CAS异常是从CAS Client里面抛出,是当我们不使用证书的CN去访问域名的时候(比如下文是用IP访问而且证书的CN是该IP对应的域名而非该IP),CASClient无法信任,因为你证书的CN命名写着abc.com,192.168.1.111这个IP是无法被CAS Client识别。

edu.yale.its.tp.cas.client.CASAuthenticationException: Unable to validate ProxyTicketValidator [[edu.yale.its.tp.cas.client.ProxyTicketValidator proxyList = [ null ] [edu.yale.its.tp.cas.client.ServiceTicketValidator casValidateUrl = [https: // 192.168.1.111:8443/cas/proxyValidate] ticket=[ST-0-9h7Mx5HK3pfsdxRvMD3y] service=[http%3A%2F%2F192.168.1.222%3A8080%2Fservlets-examples%2Fservlet%2FHelloWorldExample] renew=false]]]
    at edu.yale.its.tp.cas.client.CASReceipt.getReceipt(CASReceipt.java: 52 )
    at edu.yale.its.tp.cas.client.filter.CASFilter.getAuthenticatedUser(CASFilter.java:
455 )
    at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:
378 )
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
202 )
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173 )
    at filters.ExampleFilter.doFilter(ExampleFilter.java:
101 )
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
202 )
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173 )
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213 )
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
178 )
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:
432 )
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
126 )
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
105 )
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
107 )
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
148 )
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
869 )
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
664 )
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
527 )
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
80 )
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:
684 )
    at java.lang.Thread.run(Thread.java:
595 )
Caused by: java.io.IOException: HTTPS hostname wrong:  should be 
< 192.168 . 1.111 >
    at sun.net.www.protocol.https.HttpsClient.checkURLSpoofing(HttpsClient.java:
493 )
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:
418 )
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
170 )
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
905 )
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:
234 )
    at edu.yale.its.tp.cas.util.SecureURL.retrieve(SecureURL.java:
84 )
    at edu.yale.its.tp.cas.client.ServiceTicketValidator.validate(ServiceTicketValidator.java:
212 )
    at edu.yale.its.tp.cas.client.CASReceipt.getReceipt(CASReceipt.java:
50 )

解决办法:
用域名访问,域名就是证书的CN。

posted @ 2006-09-05 18:20 david.turing 阅读(3384) | 评论 (2)编辑 收藏

CeltiXfireProposal让Axis2在Apache的地位被动摇?

     摘要: CeltiXfire入主Apache,将如何影响Axis2的地位?  阅读全文

posted @ 2006-08-28 13:51 david.turing 阅读(3640) | 评论 (5)编辑 收藏

思考Spring拦截技术与Web Service异常处理的结合

通常,良好的架构都会有很好的异常处理模式,Web Service也不例外。
例外的是,当你的项目比较庞大的时候,你的业务方法可能很多并且你并不了解他们的内部实现。
作为一个优秀的Web Service架构师,你需要解决Web服务跟这些业务异常的结合问题。

现实是我们都不想关心这些业务类的实现,尽管这些异常从Java类抛出,并且Web服务必须处理这些
异常,起码,你需要让客户端知道:web服务端抛出异常。

以XFire为例, 假设有一个Web服务A和一个调用A的客户端B
A服务端 B客户端
当B->A发起一个Web服务请求,A抛出异常的时候,会直接new XFireFault并扔向XFire客户端。
解耦思路带领下,应该先将异常处理剥离出来。
于是,有
A服务-A异常处理handler  B客户端-B异常处理handler
这样,从架构的角度,A/B均无需考虑异常问题。

XFire客户端可以通过addFaultHandler来增加异常处理,XFire服务端则可以通过典型的AOP异常拦截来隔离
业务逻辑和Web服务之间的纽带。

posted @ 2006-08-26 00:24 david.turing 阅读(1962) | 评论 (2)编辑 收藏

跟XFire对比, AXIS2是垃圾吗?

     摘要: AXIS2究竟要不要用, AXIS2跟XFIRE的差别是什么?  阅读全文

posted @ 2006-08-23 12:40 david.turing 阅读(11237) | 评论 (17)编辑 收藏

Amazing GIF

If your eyes follow the movement of the rotating pink dot, you will only see one color: PINK

If you stare at the black + in the center, the moving dot turns to GREEN

Now, concentrate on the black + in the center of the picture...

After a short period of time, all the pink dots will slowly disappear, and you will only see a green dot rotating.

It's amazing how our brain works. There really is no green dot, and the pink ones really don't disappear.

This gif prove the chinese famous saying:  凡事不要只看表象

coverConsWatermarked_smooth.gif

[该GIF经过Gif4J库处理]

posted @ 2006-08-19 09:35 david.turing 阅读(1206) | 评论 (1)编辑 收藏

关于在Spring中如何统一控制Hibernate和JDBC的事务的讨论记录

 Totodo(888669) 13:17:17
HB 和  JDBC 同一个事务?
水木-Spring(3330309) 13:17:40
jdbc也是有事务的.
水木-Spring(3330309) 13:17:54
hibernate只不过封装呢jdbc的事务而已
水木-Spring(3330309) 13:19:01
同一个数据源?
Water Ye(54422686) 13:19:56
同一个connection的话, 这样应该可以
t.beginTransaction();
a.method();
b.method();
t.commit();

 Totodo(888669) 13:21:14
是滴,这个比较头疼..

 Totodo(888669) 13:21:35
 我们后来是传 session,然后session.getConnection.
水木-Spring(3330309) 13:22:19
如果是session.getConnection那就是同一个connection了
xxxxxxx(12345678) 13:25:24
其实我并不知道他们是怎么搞得,我觉得应该不同connection,因为只有我用了Hibernate,其他模块都没用,怎么可能同一个connection阿,头痛!
水木-Spring(3330309) 13:24:12
这个是非常麻烦的,即使使用jta都是很麻烦,因为没有spring这样的事务配置管理,jta的事务代码需要自己写.麻烦啊
 Totodo(888669) 13:24:41
  嘻嘻,我们现在最好的业务系统模型,,基于存储过程架构的.dao只是查查数据而已..
水木-Spring(3330309) 13:24:55
这个事前没有约定一些规则.怎么会出现这种情况?
xxxxxxx(12345678) 13:28:17
ok,假如我在HB里面用他们的connection,行不行?
水木-Spring(3330309) 13:26:16
这个说的就不专业了,大侠给说说,你怎么用他们的connection?
水木-Spring(3330309) 13:26:27
让俺学习学习.
xxxxxxx(12345678) 13:29:42
我不知道,我极少涉及到事务
 Totodo(888669) 13:27:14
  SessionFactroy 用的是datasource .大哥..
水木-Spring(3330309) 13:27:18
hibernate里的connection是sessionFactory产生出来的,你能用jdbc的连接,厉害.
水木-Spring(3330309) 13:27:43
跟事务是两回事啊.
xxxxxxx(12345678) 13:30:38
就是嘛,我就是这个意思
水木-Spring(3330309) 13:28:12
如果你说,jdbc用你session里产生的connection,我还觉的说的过去.
xxxxxxx(12345678) 13:30:54
我想知道怎么解决jdbc跟hb的事物
水木-Spring(3330309) 13:28:31
两种方法
xxxxxxx(12345678) 13:31:12
这是我的代码
   Configuration config = new Configuration().configure();
   SessionFactory sf = config.buildSessionFactory();
   s = sf.openSession();
   Transaction tx = s.beginTransaction();

   Criteria cr = s.createCriteria(TSign.class);
xxxxxxx(12345678) 13:31:42
哦?你觉得在哪一边改动比较好?
水木-Spring(3330309) 13:29:27
哦?首先问你个问题,你的代码怎么和别人的代码交互的?
 Totodo(888669) 13:30:11
  好久没看到这样的代码了 
   Configuration ,Sf,Transaction 都能看到..
水木-Spring(3330309) 13:30:25
在你的代码里调用别人的代码?
水木-Spring(3330309) 13:31:07
准确的说,Configuration ,Sf这样的代码确实比较少见了.
水木-Spring(3330309) 13:31:25
如果不使用spring的话,Transaction是必不可少的.
xxxxxxx(12345678) 13:34:23
别人Call我的
水木-Spring(3330309) 13:31:59
话说回来,david.turing你这段代码本身就有问题的.
水木-Spring(3330309) 13:32:08
应该说效率很低的.
xxxxxxx(12345678) 13:34:48
这些代码是Workshop生成的 
水木-Spring(3330309) 13:33:11
恐怖的代码生成器啊
xxxxxxx(12345678) 13:36:14
帅哥,你的思路如何,让我借鉴一下
xxxxxxx(12345678) 13:36:42
我那时候没有用JDBCTemplate,真是一个事物
xxxxxxx(12345678) 13:36:48
失误
水木-Spring(3330309) 13:34:57
no,no,即使你没用spring里的jdbcTemplate你的这段代码也大有问题的,你自己上网查查看.
水木-Spring(3330309) 13:35:03
说一下你刚才的事务的问题.
xxxxxxx(12345678) 13:38:11
恩,把问题先解决
 Totodo(888669) 13:35:34
 我的原则不把在tx写代码里..

 不过代码都这样写,就没关系了..

 带着参数互相传吧..
水木-Spring(3330309) 13:36:30
我假设你的代码(hibernate)里调用别人(jdbc),那么你可以将session里产生的connection当作参数传递给jdbc的程序.当然,事务最终在你这里做统一提交.
水木-Spring(3330309) 13:36:47
但这种情况不好的地方就是需要是同一个connection
xxxxxxx(12345678) 13:40:18
如果是别人调用我的HB呢?
水木-Spring(3330309) 13:37:41
第二种方法就是使用jta,这种情况的好处是不仅连接可以不是同一个,数据源也可以不一样.
xxxxxxx(12345678) 13:40:33
jta,复杂否?
水木-Spring(3330309) 13:38:00
如果别人调用你的,你就晕吧.
水木-Spring(3330309) 13:39:14
jta?是否复杂,两方面,首先你的的应用服务器是什么?然后你时候使用spring这样的形式来管理事务.
xxxxxxx(12345678) 13:43:35
weblogic 8.1
xxxxxxx(12345678) 13:43:44
没用用Spring
getdown(9486681) 13:41:19
现在用Spring吧...
水木-Spring(3330309) 13:41:29
呵呵,晚了.
xxxxxxx(12345678) 13:44:09
晕倒
getdown(9486681) 13:41:46
不会晚
水木-Spring(3330309) 13:41:55
应用服务器一般都实现很好的jta
getdown(9486681) 13:41:59
原来事务代码还保存没有关系..
xxxxxxx(12345678) 13:44:43
帅哥们,我是不想负这个责任
netfishx(151431) 13:42:31
对,不是说换就换的啊
xxxxxxx(12345678) 13:45:16
JTA能解决跨Connection的问题?
getdown(9486681) 13:42:38
不用换啊..
getdown(9486681) 13:42:43
JTA可以..
getdown(9486681) 13:42:48
不过JTA有点限制
getdown(9486681) 13:43:15
我有碰到代码里面直接写connection.commit()...
getdown(9486681) 13:43:22
这种情况就不能用JTA了..
水木-Spring(3330309) 13:43:36
这叫什么限制啊,呵呵.
水木-Spring(3330309) 13:43:50
这是起码的规则吧
xxxxxxx(12345678) 13:47:04
我可以改代码啊
getdown(9486681) 13:44:03
呵呵 你不知道 原有存在的很多系统都是这么控制事务的..
水木-Spring(3330309) 13:44:27
全局事务,当然不允许你自己做提交了.呵呵.
xxxxxxx(12345678) 13:47:48
tx.commit();全部更换我都可以去做
getdown(9486681) 13:44:49
最简单的还是用Spring的HibernateTransactionMananger来管理Hibernate和JDBC的事务一致.
xxxxxxx(12345678) 13:48:00
恩!
xxxxxxx(12345678) 13:48:27
但他们如果不用Spring呢? 工作量大不大?
getdown(9486681) 13:45:30
...
水木-Spring(3330309) 13:45:44
他们不用,你还做什么啊?晕
xxxxxxx(12345678) 13:49:07
我要创造条件给他们去用
getdown(9486681) 13:46:15
这是可行的
 Totodo(888669) 13:46:19
  老实说,我不喜欢JTA...
xxxxxxx(12345678) 13:49:23
但是要我把HB->JDBC我死活不愿意的
xxxxxxx(12345678) 13:49:42
他们也不会JDBC->HB
水木-Spring(3330309) 13:46:45
其实david.turing,你的这个改造不是很麻烦的,至少你不是跨数据源的.
xxxxxxx(12345678) 13:49:53
恩....
水木-Spring(3330309) 13:47:09
但是改造的话,风险也不小的.
xxxxxxx(12345678) 13:50:11
答案,我等不及了
getdown(9486681) 13:47:14
那就用HibernateTransactionManager来管理吧,我试过,改动最小..
getdown(9486681) 13:47:17
风险也最小..
xxxxxxx(12345678) 13:50:29
JDBC?
getdown(9486681) 13:47:30
我刚刚在一个大项目的二次开发里面用
xxxxxxx(12345678) 13:50:36

getdown(9486681) 13:47:52
HibernateTransactionManager可以同时保证JDBC和Hibernate的事务一致..
xxxxxxx(12345678) 13:51:47
有你这句话就行了
xxxxxxx(12345678) 13:52:00
getdown,给一个配置的sample我看看如何?
getdown(9486681) 13:48:59
呵呵 这个你放心了 我很仔细的试过了..
getdown(9486681) 13:49:07
ok
xxxxxxx(12345678) 13:52:12
thx!!!
 Totodo(888669) 13:52:44
getdown(9486681) 13:44:49
最简单的还是用Spring的HibernateTransactionMananger来管理Hibernate和JDBC的事务一致. 
getdown(9486681) 13:52:53
?
 Totodo(888669) 13:53:02
 牛了..我要学习一下.
 Totodo(888669) 13:53:54
 好比Spring 我有一段这样子配的..
 Totodo(888669) 13:53:56
  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->

 <bean id="rscTransactionControl" class="org.springframework.orm.hibernate.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref local="rscSessionFactory" />
  </property>
 </bean>
 
 Totodo(888669) 13:54:40
对应的事务控制分别是..

 <bean id="txAttributes" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
  <property name="properties">
   <value>
     *=PROPAGATION_REQUIRED
     do*=PROPAGATION_REQUIRED
   < alue>
  </property>
 </bean>
 
 <bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
  <property name="transactionManager">
   <ref bean="rscTransactionControl" />
  </property>
  <property name="transactionAttributeSource">
   <ref bean="txAttributes" />
  </property>
 </bean>
 Totodo(888669) 13:55:20
 HB事务控制的

 <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  <property name="interceptorNames">
   <value>txInterceptor< alue>
  </property>
  <property name="beanNames">
   <list>
    <value>*DAO< alue>
    <value>*Manager< alue>
   < st>
  </property>
 </bean>
    
 Totodo(888669) 13:55:45
 而我另外用个JDBC的..
 Totodo(888669) 13:55:49
  <bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate">
  <constructor-arg>
   <ref bean="rscDataSource" />
  </constructor-arg>
 </bean>
 Totodo(888669) 13:56:33
 JDBC 怎么被  HibernateTransactionManager, 管理上?
getdown(9486681) 13:56:44
呵呵...
getdown(9486681) 13:56:59
我发给你看看
netfishx(151431) 13:57:12
贴出来都看看嘛
getdown(9486681) 13:57:27
ok 那我就贴出来看吧..
 Totodo(888669) 13:57:28
 要看哦..
getdown(9486681) 13:57:46
前面的简单 ..先
 <bean id="baseService" lazy-init="true" abstract="true"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

  <property name="transactionManager" ref="transactionManager" />

  <property name="transactionAttributes">
   <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
   </props>
  </property>

 </bean>
getdown(9486681) 13:57:59
这个等于是总的Service的配置.
 Totodo(888669) 13:58:07
  er..
 Totodo(888669) 13:58:09
en ..
getdown(9486681) 13:58:33
然后 JDBC的..
 <bean id="userJdbcDao"
  class="com.gfa4j.demo.jdbc.impl.UserJdbcDaoImpl">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
 </bean>
getdown(9486681) 13:59:09
然后是Service的...
 <bean id="userJdbcService" parent="baseService">
  <property name="target">
   <bean
    class="com.gfa4j.demo.jdbc.impl.UserJdbcServiceImpl">
    <property name="jdbcDao" ref="jdbcDao" />
   </bean>
  </property>
 </bean>
 Totodo(888669) 13:59:23
  OH....

getdown(9486681) 13:59:37
这个时候其实调用JDBC的时候等于用了HibernateTransactionMananger了..

 Totodo(888669) 14:00:35
这里的ref de   transcationManager  就是 HibernateTransactionMananger 么?
getdown(9486681) 14:00:39
嗯..
getdown(9486681) 14:00:44
两个用的都是..
 Totodo(888669) 14:00:49
天才啊..
getdown(9486681) 14:00:59
 <bean id="userHibernateService" parent="baseService">
  <property name="target">
   <bean
    class="com.gfa4j.demo.service.impl.UserHibernateServiceImpl">
    <property name="userJdbcService" ref="userJdbcService" />
   </bean>
  </property>
 </bean>
getdown(9486681) 14:01:07
这个是Hibernate Service
getdown(9486681) 14:01:14
这样就可以很方便的调用了..
netfishx(151431) 14:01:19
这样就可以???
getdown(9486681) 14:01:23
嗯 ...

 


 Totodo(888669) 15:29:45
 看了JdbcTemplate 的源..
 Totodo(888669) 15:29:46
 
 //-------------------------------------------------------------------------
 // Methods dealing with static SQL (java.sql.Statement)
 //-------------------------------------------------------------------------

 public Object execute(StatementCallback action) throws DataAccessException {
  Connection con = DataSourceUtils.getConnection(getDataSource());
  Statement stmt = null;
  try {
   Connection conToUse = con;
   if (this.nativeJdbcExtractor != null &&
     this.nativeJdbcExtractor.isNativeConnectionNecessaryForNativeStatements()) {
    conToUse = this.nativeJdbcExtractor.getNativeConnection(con);
   }
   stmt = conToUse.createStatement();
   DataSourceUtils.applyTransactionTimeout(stmt, getDataSource());
   Statement stmtToUse = stmt;
   if (this.nativeJdbcExtractor != null) {
    stmtToUse = this.nativeJdbcExtractor.getNativeStatement(stmt);
   }
   Object result = action.doInStatement(stmtToUse);
   SQLWarning warning = stmt.getWarnings();
   throwExceptionOnWarningIfNotIgnoringWarnings(warning);
   return result;
  }
  catch (SQLException ex) {
   throw getExceptionTranslator().translate("executing StatementCallback", getSql(action), ex);
  }
  finally {
   JdbcUtils.closeStatement(stmt);
   DataSourceUtils.closeConnectionIfNecessary(con, getDataSource());
  }
 }
 Totodo(888669) 15:31:42
 public static Connection doGetConnection(DataSource dataSource, boolean allowSynchronization)
   throws SQLException {
  Assert.notNull(dataSource, "No DataSource specified");

  ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(dataSource);
  if (conHolder != null) {
   conHolder.requested();
   return conHolder.getConnection();
  }

  logger.debug("Opening JDBC connection");
  Connection con = dataSource.getConnection();
  if (allowSynchronization && TransactionSynchronizationManager.isSynchronizationActive()) {
   logger.debug("Registering transaction synchronization for JDBC connection");
   // Use same Connection for further JDBC actions within the transaction.
   // Thread-bound object will get removed by synchronization at transaction completion.
   conHolder = new ConnectionHolder(con);
   TransactionSynchronizationManager.bindResource(dataSource, conHolder);
   TransactionSynchronizationManager.registerSynchronization(new ConnectionSynchronization(conHolder, dataSource));
   conHolder.requested();
  }

  return con;
 }
 Totodo(888669) 15:35:37
jdbc 用的是 DataSourceTransactionManager
hb 用的是 HibernateTransactionManager
 Totodo(888669) 15:39:51
It is possible--and sometimes useful--to have coordinated transactions for both. Your JDBC transactions will be managed by the HibernateTransactionManager if you work with the same JDBC DataSource in the same transaction. That is, create the SessionFactory using Spring's SessionFactoryBean using the same DataSource that your JdbcTemplates use.

The only issue to watch, of course, is that you may be invalidating your Hibernate cache by JDBC changes. Generally I find it best to use JDBC to update only tables that don't have Hibernate mappings.
It is possible--and sometimes useful--to have coordinated transactions for both. Your JDBC transactions will be managed by the HibernateTransactionManager if you work with the same JDBC DataSource in the same transaction. That is, create the SessionFactory using Spring's SessionFactoryBean using the same DataSource that your JdbcTemplates use.

The only issue to watch, of course, is that you may be invalidating your Hibernate cache by JDBC changes. Generally I find it best to use JDBC to update only tables that don't have Hibernate mappings.
 
 Totodo(888669) 15:46:14
 貌似可以啊....奇怪...
 Totodo(888669) 15:47:36
 sorry...骚扰了大家很久....
 Totodo(888669) 15:47:42
 我还是想问下..
 Totodo(888669) 15:49:01
   <bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate">
  <constructor-arg>
   <ref bean="rscDataSource" />
  </constructor-arg>
 </bean>
 
 <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->

 <bean id="rscTransactionControl" class="org.springframework.orm.hibernate.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref local="rscSessionFactory" />
  </property>
 </bean>

 <bean id="portAssignerDAO" class="bss.resourcemanager.rscass.assport.dao.impl.PortAssignerDAOImpl">
  <property name="sessionFactory">
   <ref bean="rscSessionFactory" />
  </property>
  <property name="jdbcTemplate">
   <ref bean="jdbc" />
  </property>
 </bean>


为什么我的portAssignerDAO ,用 hb ,和jdbc 不能保证再同一个事务中呢?
 Totodo(888669) 15:49:25
getDown..

 

 


 Totodo(888669) 15:55:36
至少.我能证明 

   <bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate">
  <constructor-arg>
   <ref bean="rscDataSource" />
  </constructor-arg>
 </bean>
 
 <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->

 <bean id="rscTransactionControl" class="org.springframework.orm.hibernate.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref local="rscSessionFactory" />
  </property>
 </bean>

 <bean id="portAssignerDAO" class="bss.resourcemanager.rscass.assport.dao.impl.PortAssignerDAOImpl">
  <property name="sessionFactory">
   <ref bean="rscSessionFactory" />
  </property>
  <property name="jdbcTemplate">
   <ref bean="jdbc" />
  </property>
 </bean>

这个是肯定不在一个事务里的..
 
 Totodo(888669) 15:56:23
 portAssignerDAO.updateByJdbc(xxxxxx);
  portAssignerDAO.updateByHb(xxxxxx);
 Totodo(888669) 15:57:30
 从去年上半年开始几乎没怎么用HB了....所以关注的不多....

但是HB混用jdbctempate  记忆深刻啊...
 Totodo(888669) 15:58:32
 而且,我们系统在线运行的时候.websphere的日志 一支就是很多报 不在一个事务上,而且绑定不了。 ..
 Totodo(888669) 15:59:36
getDown...在么?
 Totodo(888669) 15:59:38
    <bean id="baseService" lazy-init="true" abstract="true"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

  <property name="transactionManager" ref="transactionManager" />

  <property name="transactionAttributes">
   <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
   </props>
  </property>

 </bean>
 
 <bean id="userJdbcDao"
  class="com.gfa4j.demo.jdbc.impl.UserJdbcDaoImpl">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
 </bean>

 <bean id="userJdbcService" parent="baseService">
  <property name="target">
   <bean
    class="com.gfa4j.demo.jdbc.impl.UserJdbcServiceImpl">
    <property name="jdbcDao" ref="userJdbcDao" />
   </bean>
  </property>
 </bean>


   <bean id="userHibernateService" parent="baseService">
  <property name="target">
   <bean
    class="com.gfa4j.demo.service.impl.UserHibernateServiceImpl">
    <property name="userJdbcService" ref="userJdbcService" />
   </bean>
  </property>
 </bean> 
 Totodo(888669) 16:00:05
能否发个 UserJdbcDaoImpl 看一下..
 Totodo(888669) 16:03:20
  是否 UserJdbcDaoImpl 直接集成 JdbcDAOSupport?
 Totodo(888669) 16:09:00
 Er...
 Totodo(888669) 16:09:44
千古大错啊......
 Totodo(888669) 16:10:25
 我误导了一波子人......
 Totodo(888669) 16:10:40
 非常感谢 getDown 和 水母Spring
netfishx(151431) 16:11:11
 水母
无声的海浪(4485373) 16:12:28
 
getdown(9486681) 16:16:54
我是直接extends JdbcDAOSupport . 
 Totodo(888669) 16:17:12
 对,继承JdbcDAOSupport
 Totodo(888669) 16:17:18
 我明白了.
 Totodo(888669) 16:17:44
 可能就是因为 我们的直接 

   <bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate">
  <constructor-arg>
   <ref bean="rscDataSource" />
  </constructor-arg>
 </bean>
 Totodo(888669) 16:18:06
我拿你的配置,简单配了一个,,的确保证在一个事务中.
getdown(9486681) 16:18:15
 
 Totodo(888669) 16:18:50
 难道直接 用JdbcTemplate 和 extentds JdbcDAOSupport 有差别..
无声的海浪(4485373) 16:19:54
没有差别
从外貌上看需要的参数都是datasource
 Totodo(888669) 16:20:37
  我再拿getdown 那种方式换成 我原来的试一下,结果一会儿遍知
无声的海浪(4485373) 16:21:57
那你把JdbcTemplate的参数换成JdbcTemplate
再try一下
 
 Totodo(888669) 16:22:41
 是的..我另外给dao配置了一个jdbcTempalte 属性 ,set..
水木-Spring(3330309) 16:23:17
这种方式不行?
无声的海浪(4485373) 16:23:36
和你用datasource一样吗?
无声的海浪(4485373) 16:24:26
如果一样,你原来的方式也同样可以
道理是一样的
水木-Spring(3330309) 16:25:35
刚才我就说了,getdown用的那个extends是一种方式,如果不想继承的话,可以注入嘛?
水木-Spring(3330309) 16:26:22
这种注入是没有问题的.
水木-Spring(3330309) 16:26:36
和继承是一样可行的.
无声的海浪(4485373) 16:26:45

 Totodo(888669) 16:26:55
  这个知道的拉..其实,我一开始的配置,和getDown没有本质差别...
无声的海浪(4485373) 16:27:09
刚才我说的就是水母的意思
水木-Spring(3330309) 16:27:25
总之,这两种方法都是可以的.
水木-Spring(3330309) 16:27:46
有的人不喜欢继承,觉得是强耦合,那么可以选择注入.
getdown(9486681) 16:27:49
 Totodo  getdown 中间不要加大写 写成getDown难看....
 Totodo(888669) 16:27:52
 一种已经被证实有问题了..

 另外一种还没有被证实..
 Totodo(888669) 16:28:05
 正在证实中..
水木-Spring(3330309) 16:28:31
那种有问题?
无声的海浪(4485373) 16:28:48
... ...是不是你的写法有问题呢?
水木-Spring(3330309) 16:28:51
继承还是注入?
 Totodo(888669) 16:29:11
 我的这种方式.. 注入.

  <bean id="jdbc" class="org.springframework.jdbc.core.JdbcTemplate">
   <constructor-arg>
    <ref bean="rscDataSource" />
   </constructor-arg>
  </bean>
  
 <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->

 <bean id="rscTransactionControl" class="org.springframework.orm.hibernate.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref local="rscSessionFactory" />
  </property>
 </bean>

 <bean id="portAssignerDAO" class="bss.resourcemanager.rscass.assport.dao.impl.PortAssignerDAOImpl">
  <property name="sessionFactory">
   <ref bean="rscSessionFactory" />
  </property>
  <property name="jdbcTemplate">
   <ref bean="jdbc" />
  </property>
 </bean>
 Totodo(888669) 16:29:46
 portAssignerDAO 是 extends HibernateDAOSupport 的..
 Totodo(888669) 16:30:39
  同时使用jdbc 和 saveOrUpdate就有问题呢...
水木-Spring(3330309) 16:31:06
你试试同时注入jdbcTemplate和HiberanteTemplate试试.
 Totodo(888669) 16:31:34
 先不玩了..晚上拿demo发给大家一起看一下,如果有兴趣的话...

 反正现在对hb不感冒是了..
水木-Spring(3330309) 16:31:45
呵呵
 Totodo(888669) 16:31:48
 要忙了,,失陪一会儿.
无声的海浪(4485373) 16:32:07

posted @ 2006-08-10 18:03 david.turing 阅读(1995) | 评论 (0)编辑 收藏

解决异常:Parser has reached the entity expansion limit "64,000" set by the Application

异常:分析器已达到由应用程序设置的实体扩展限制"64,000"

用JDOM分析一个超大的xml文件,大概20M,估计有很多Elements:

  SAXBuilder saxbuilder = null;
  Document doc_all=null;

  saxbuilder = new SAXBuilder(); // 新建立构造器
  
  try {
   FileInputStream xmlfile=new FileInputStream("verybig.xml");
   doc_all=saxbuilder.build(xmlfile); // 读入文件
  } catch (FileNotFoundException e) {
   System.err.println("缺少文件!请检查");
   System.exit(-1);
  } catch (JDOMException e) {
   System.err.println("解析XML模板文件出错!请检查");
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  }

抛出异常:
reached the entity expansion limit "64,000" set by the Application.
        at TErrorHandler.fatalError(XMLError.java:198)
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3342)
        at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3333)
        at org.apache.crimson.parser.Parser2.expandEntityInContent(Parser2.java:2667)
        at org.apache.crimson.parser.Parser2.maybeReferenceInContent(Parser2.java:2569)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1980)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1926)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1654)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:634)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:333)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
        at XMLError.DOMRead(XMLError.java:101)
        at XMLError.main(XMLError.java:30)

中文翻译是:分析器已达到由应用程序设置的实体扩展限制"64,000"

原来是JAXP的bug,换JDK1.5解决!

posted @ 2006-08-10 16:22 david.turing 阅读(557) | 评论 (0)编辑 收藏

[原创]实施WebService Security[WS-Security1.0]的Encrypt和Sign模式(XFire+WSS4J)

     摘要: 本文介绍如何让XFire跟WebService Security结合起来,目前为止,XFire选择了WSS4J(支持WS-Security1.0标准),我为SpringSide加入了WSS4J的3个认证例子(UsernameToken模式,Encrypt模式,Sign模式),大家可以到Springside SVN下载。  阅读全文

posted @ 2006-08-08 09:09 david.turing 阅读(11610) | 评论 (41)编辑 收藏

在SpringSide实现XFire Webservice认证

XFire官方网站提供的基于Webservice认证的例子有问题,在新版本的XFire1.1.2中编译不通过,不过这也是小Case,我后来折腾了一下,为SpringSide提供了一个简单的Webservice认证功能。
XFire跟Spring的天然融合,让我们可以少努力10年就能简单地在Spring中使用Webservice的强大魅力,我从AXIS专向XFire有一些冲动,也吃了不少亏,但受REST一族的强力吹捧,感觉还是值得尝试的,因此,在公司的系统中也把Axis彻底换了XFire。

回到SpringSide,我大概介绍一下如何配置一个真正实用的XFire验证服务。
SpringSide中的XFire配置文件放在:
SpringSide-bookstore\src\org\springside\bookstore\plugins\webservice\applicationContext-webservice-server.xml
我们在里面定义各个Webservice,该文件其实对应于XFire官方的XFire-Servlet.xml
看看下面的BookService,这是一个典型的Webservice服务,红色的inHandlers是我挂上去的。它的意思是所有访问BookService的请求都会被先送到authenticationHandler去处理,我们的验证逻辑可以在里面进行。
    <!--Web Service 在SpringMVC中的URL 路径映射-->
    <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <value>/BookService=bookWebService</value>
        </property>
        <property name="inHandlers">
            <ref bean="authenticationHandler"/>
        </property>

    </bean>

我们接着看看authenticationHandler的代码:
我们在SpringSide中通过header方式向服务器提供验证信息(另外一种更简单的方式是创建一个Login的webservice服务,然后在XFire Session中建立Token信息)。
package org.springside.bookstore.plugins.webservice.authentication;

import org.apache.log4j.Logger;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.exchange.InMessage;
import org.codehaus.xfire.fault.XFireFault;
import org.codehaus.xfire.handler.AbstractHandler;
import org.jdom.Element;
import org.jdom.Namespace;


/**
 * XFire的回调的Handler,在XFire配置文件中配置
 * Server端的认证模块,回调处理模块
 * 
 * ClientAuthHandler跟AuthenticationHandler要一起用,或者都不用
 * 
 * 
@author  david.turing
 * @blog  openssl.blogjava.net
 *
 
*/
public class AuthenticationHandler extends AbstractHandler {
    
private static final Logger log = Logger.getLogger(AuthenticationHandler.class);
    
    
public void invoke(MessageContext context) throws Exception {
        
        log.info(
"#AuthenticationHandler is invoked");
        InMessage message
=context.getInMessage();
        
        
final Namespace TOKEN_NS = Namespace.getNamespace("SpringSide","http://service.webservice.plugins.bookstore.springside.org");  
        
        
if(message.getHeader()==null)
        {
            
throw new XFireFault("GetRelation Service Should be Authenticated",
                    XFireFault.SENDER);
        }
        
        Element token 
= message.getHeader().getChild("AuthenticationToken", TOKEN_NS);
        
if (token == null)
        {
            
throw new XFireFault("Request must include authentication token.",
                                 XFireFault.SENDER);
        }

        String username 
= token.getChild("Username", TOKEN_NS).getValue();
        String password 
= token.getChild("Password", TOKEN_NS).getValue();

        System.out.println(
"username="+username);        
        System.out.println(
"password="+password);
        
        
if(username==null||password==null)
            
throw new XFireFault("Supplied Username and Password Please",
                    XFireFault.SENDER);
        
        
/**
         * 检查用户名密码是否正确
         
*/
        PasswordAuthenticationManager pamanager
=new PasswordAuthenticationManager();
        
if(!pamanager.authenticate(username,password))
            
throw new XFireFault("Authentication Fail! Check username/password",
                    XFireFault.SENDER);
 
        
    }
}
注意,XFireFault异常是往客户端抛的,Webservice Client应该学会catch XFireFault.

服务器端就是这么简单,看看客户端的TestCase
package org.springside.bookstore.plugins.webservice.service;

import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.util.List;

import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.client.XFireProxy;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.springside.bookstore.commons.domain.Book;
import org.springside.bookstore.plugins.webservice.authentication.ClientAuthHandler;

import junit.framework.TestCase;

public class BookServiceWithAuthenticationTestCase extends TestCase {

    
protected void setUp() throws Exception {
        
super.setUp();
    }

    
protected void tearDown() throws Exception {
        
super.tearDown();
    }
    
    
public void getBookFromWebservice() throws Exception{
    
          Service serviceModel 
= new ObjectServiceFactory()
                .create(BookService.
class);
        BookService service 
= null;
        
        
try {
            service
=(BookService) new XFireProxyFactory().create(
                    serviceModel,
                    
"http://localhost:8080/springside/service/BookService");
        } 
catch (MalformedURLException e) {
            e.printStackTrace();
        }
        
        Client client 
= ((XFireProxy) Proxy.getInvocationHandler(service)).getClient();
        
//挂上ClientAuthHandler,提供认证
        client.addOutHandler(new ClientAuthHandler());
        List list 
= service.findBooksByCategory(null);
        assertNotNull(list);
        
for(int i=0;i<list.size();i++)
            System.out.println(((Book)list.get(i)).getName());
    }

}

你应该看到上面的client.addOutHandler(new ClientAuthHandler());
没错,它跟服务器端的AuthenticationHandler是一对,一起使用的!
也就是,每个被送往WebService服务的请求都被ClientAuthHandler处理过了。
看看ClientAuthHandler做了些什么:
package org.springside.bookstore.plugins.webservice.authentication;

import org.apache.log4j.Logger;
import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.handler.AbstractHandler;
import org.jdom.Element;
import org.jdom.Namespace;

/**
 * 客户端端的认证模块,回调处理模块
 * 每个需要认证的WebService方法都可以挂这个Handler
 * 
 * 仅用于Demo,从解耦和易用性出发,
 * 没有跟Acegi结合,你可以任意扩展
 * 默认用户名/密码是admin/admin
 * 
 * ClientAuthHandler跟AuthenticationHandler要一起用,或者都不用
 * 
 * 
@author  david.turing
 *
 * @blog openssl.blogjava.net
 
*/    
public class ClientAuthHandler extends AbstractHandler {
        
private static final Logger log = Logger.getLogger(ClientAuthHandler.class);
        
        
//客户端自己配置用户名密码或者更安全的KeyStore方式
        private String username = "admin";
        
private String password = "admin";
        
        
public ClientAuthHandler() {
        }
        
        
public ClientAuthHandler(String username,String password) {
            
this.username = username;
            
this.password = password;
        }
        
        
public void setUsername(String username) {
            
this.username = username;
        }
        
        
public void setPassword(String password) {
            
this.password = password;
        }
        
        
public void invoke(MessageContext context) throws Exception {
                        
            
/*******************************************
             * Soap Header方式
             * 从Soap Header中获取用户名密码
             ******************************************
*/
            
final Namespace ns = Namespace.getNamespace("SpringSide","http://service.webservice.plugins.bookstore.springside.org");  
            Element el 
= new Element("header",ns);

            Element auth 
= new Element("AuthenticationToken", ns);
            Element username_el 
= new Element("Username",ns);
            username_el.addContent(username);
            Element password_el 
= new Element("Password",ns);
            password_el.addContent(password);
            auth.addContent(username_el);
            auth.addContent(password_el);
            el.addContent(auth);            
            context.getCurrentMessage().setHeader(el);            
            log.info(
"ClientAuthHandler done!");
        }
    }

不就是往header里面注入username,password!

在SpringSide中,所有的Spring配置文件都被小白分散到各个Module中去了,Wuyu原先是在Plugin中提供Webservice功能,因此,我仍然在Plugin中创建XFire接口。
SpringSide的Spring配置文件放在:
SpringSide-bookstore\webapp\WEB-INF\springmvc-servlet.xml
该文件定义了Plugin的xml:
AuthenticationHandler这个Bean需要先定义在Plugins-servlet.xml中,其它很简单,大家去Try一下就知道了。

posted @ 2006-07-25 23:48 david.turing 阅读(5795) | 评论 (4)编辑 收藏

重新实现JCAPI的JCE Provider

The Pheox JCAPI (http://pheox.com/download) 提供一个JCE Provider可以直接操作Microsoft 操作系统本地证书库/私钥的。JCAPI用一个jcapi.dll封装了这些复杂性,这个dll负责调用Windows内置的CSP来完成加密签名哈希等密码运算。
JCAPI.DLL属于轻量级的中间层类库,它让Java开发者免去对待CSP的细节,比如获得一个CSP的Handle。
JCAPI.dll提供了下面的JNI调用:
00000001    10002AA0    _Java_com_pheox_jcapi_CoreCipherJNI_decrypt@24
00000002    100021A0    _Java_com_pheox_jcapi_CoreCipherJNI_encrypt@20
00000003    100027A0    _Java_com_pheox_jcapi_CoreCipherJNI_encryptWithPrivateKey@20
00000004    10001E10    _Java_com_pheox_jcapi_CoreCipherJNI_getPrivateKeySize@12
00000005    10003610    _Java_com_pheox_jcapi_CoreKeyStoreJNI_aliases@16
00000006    100039D0    _Java_com_pheox_jcapi_CoreKeyStoreJNI_containsAlias@12
00000007    10005E50    _Java_com_pheox_jcapi_CoreKeyStoreJNI_createBase64Hash@12
00000008    10003B30    _Java_com_pheox_jcapi_CoreKeyStoreJNI_deleteEntry@12
00000009    10003DA0    _Java_com_pheox_jcapi_CoreKeyStoreJNI_getCertificate@12
0000000A    10003FE0    _Java_com_pheox_jcapi_CoreKeyStoreJNI_getCertificateChain@
20
0000000B    
10004530    _Java_com_pheox_jcapi_CoreKeyStoreJNI_getKey@12
0000000C    10004C00    _Java_com_pheox_jcapi_CoreKeyStoreJNI_isKeyEntry@
12
0000000D    10004E00    _Java_com_pheox_jcapi_CoreKeyStoreJNI_setCertificateEntry@
16
0000000E    
10005020    _Java_com_pheox_jcapi_CoreKeyStoreJNI_setKeyEntry@44
0000000F    10005CA0    _Java_com_pheox_jcapi_CoreKeyStoreJNI_size@
16
00000010    100062A0    _Java_com_pheox_jcapi_CoreSignatureJNI_hashFinal@12
00000011    10005F80    _Java_com_pheox_jcapi_CoreSignatureJNI_hashInit@12
00000012    10006140    _Java_com_pheox_jcapi_CoreSignatureJNI_hashUpdate@16
00000013    10006430    _Java_com_pheox_jcapi_CoreSignatureJNI_sign@28
00000014    10006F60    _Java_com_pheox_jcapi_CoreSignatureJNI_verify@28
00000015    10007CF0    _Java_com_pheox_jcapi_CoreUtilJNI_addPKCS11CSP@16
00000016    10007880    _Java_com_pheox_jcapi_CoreUtilJNI_createCertEntryStore@8
00000017    10007C20    _Java_com_pheox_jcapi_CoreUtilJNI_getAddedPKCS11CSPs@8
00000018    100078E0    _Java_com_pheox_jcapi_CoreUtilJNI_getCSP@12
00000019    10008F10    _Java_com_pheox_jcapi_CoreUtilJNI_getCertStoreFriendlyName@12
0000001A    100089C0    _Java_com_pheox_jcapi_CoreUtilJNI_getCertificateFriendlyName@
12
0000001B    
10007500    _Java_com_pheox_jcapi_CoreUtilJNI_getJCAPIDLLVersion@8
0000001C    
10007520    _Java_com_pheox_jcapi_CoreUtilJNI_getMSCSPs@8
0000001D    
10009010    _Java_com_pheox_jcapi_CoreUtilJNI_getMSCertStoreNames@8
0000001E    10007E20    _Java_com_pheox_jcapi_CoreUtilJNI_getPKCS11DLLName@
12
0000001F    100083F0    _Java_com_pheox_jcapi_CoreUtilJNI_getPKCS11TokenInfo@
12
00000020    10007B50    _Java_com_pheox_jcapi_CoreUtilJNI_getSupportedPKCS11CSPs@8
00000021    100077A0    _Java_com_pheox_jcapi_CoreUtilJNI_init@12
00000022    10007F40    _Java_com_pheox_jcapi_CoreUtilJNI_isPKCS11PrivateKey@12
00000023    10007D90    _Java_com_pheox_jcapi_CoreUtilJNI_removePKCS11CSP@12
00000024    10008F90    _Java_com_pheox_jcapi_CoreUtilJNI_reportMemStatus@8
00000025    10008360    _Java_com_pheox_jcapi_CoreUtilJNI_setCallbackPinCode@12
00000026    100083B0    _Java_com_pheox_jcapi_CoreUtilJNI_setCertOpenStoreFlags@12
00000027    10008C80    _Java_com_pheox_jcapi_CoreUtilJNI_setCertificateFriendlyName@16
它调用的类库其实还是crypt32.dll和ADVAPI32.dll.
crypt32.dll:
0000002C    CertEnumSystemStore
00000041    CertGetCertificateContextProperty
0000008B    CryptFindLocalizedName
00000056    CertRegisterSystemStore
00000097    CryptHashCertificate
00000061    CertSetCertificateContextProperty
00000019    CertCreateCertificateContext
00000004    CertAddCertificateContextToStore
00000044    CertGetIssuerCertificateFromStore
0000001E    CertDeleteCertificateFromStore
00000029    CertEnumCertificatesInStore
0000007C    CryptDecodeObject
0000009C    CryptImportPublicKeyInfo
00000050    CertOpenStore
00000032    CertFindCertificateInStore
0000000F    CertCloseStore
0000003C    CertFreeCertificateContext

导入, ADVAPI32.dll
顺序 (示意)    名字
000000A8    CryptSignHashA
00000099    CryptGetHashParam
0000008B    CryptDestroyHash
0000009D    CryptHashData
00000088    CryptCreateHash
00000094    CryptExportKey
00000089    CryptDecrypt
0000009F    CryptImportKey
0000008F    CryptEncrypt
0000009C    CryptGetUserKey
0000009A    CryptGetKeyParam
0000008C    CryptDestroyKey
00000085    CryptAcquireContextA
000000A0    CryptReleaseContext
000000AA    CryptVerifySignatureA
00000092    CryptEnumProvidersA
000001C9    RegCloseKey
000001EC    RegQueryValueExA
000001F9    RegSetValueExA
000001CD    RegCreateKeyExA
000001E2    RegOpenKeyExA
000000A1    CryptSetHashParam

在标准的CryptoAPI函数上的封装是有必要的,因为从Java程序员的角度,我们不需要太关心CSP,我们希望直接进行Cryptography运算。

JCAPI这个provider提供3个SPI的实现,
  • java.security.KeyStoreSpi
  • java.security.SignatureSpi
  • javax.crypto.CipherSpi

    也就是,我们通过Java应用程序可以直接借助于JCE API来调用CryptoAPI。

    这个JCE API算法支持下面的基本操作

    • Add, remove, list and access X.509 certificates.
    • Add, remove, access and export RSA private keys.
    • Create signatures with RSA private keys using the following algorithms:
      • SHA1withRSA
      • MD5withRSA
      • MD2withRSA
    • Verify signatures with RSA public keys.
    • Encrypt/decrypt data with RSA public/private keys using the following algorithm, mode and padding:
      • RSA/ECB/PKCS1Padding
    • Wrap and unwrap symmetric- and asymmetric keys with RSA key pairs through MS CAPI and PKCS#11.
    • Built-in support for tested PKCS#11 CSP manufacturers that is compliant with the functions required by JCAPI.
    • Dynamically adding/removing of PKCS#11 CSPs into JCAPI.
    • Private key call-back interface for PKCS#11 providers. You can provide your own preferred Java call-back implementation to be called whenever a private key is accessed through PKCS#11.
    • List and configure MS CAPI system (certificate) stores.
    • Use a MS CAPI system (certificate) store as an un-trusted store.
    • Set and get MS CAPI friendly names for certificates.
    • Get MS CAPI friendly names for system (certificate) stores.
    • Get detailed information about your PKCS#11 hardware token through the JCAPI PKCS#11 information class.
    • Use JCAPI supported plug-ins. A JCAPI plug-in is a signed JAR file that extends or enhances the functionality of JCAPI without the need of recompiling JCAPI.
    • JCAPI SSL plugin. Use this plug-in to simplify the work of integrating the JCAPI key store for SSL enabled applications. The plug-in transparently supports both the old JSSE version for Java 1.3, and the newer versions included in Java 1.4 and higher. This plug-in transparently supports the PKCS#11 implementation as defined in Java 5. Your JCAPI supported hardware keys can be plugged in and used immediately for SSL. JCAPI will automatically configure the token for you by setting the correct slot identity to use etc.
    • JCAPI X.509 Factory plug-in. Use this plug-in to transparently replace any other X.509 certificate factories used by your Java system.
    • JCAPI is signed with a qualified code signing certificate that is trusted by all modern web browsers which makes it suitable in trusted applets.

    JCE API支持一下的系统,我只是在Windows2000上测试通过,其他平台我不能保证破解能正常使用。

    • Windows 98
    • Windows 98 SE
    • Windows ME
    • Windows 2000
    • Windows XP

    JCE 支持JDK1.4以上,JDK1.3稍微为麻烦,要自己配制JCE和JSSE

    • Java 1.3.1 with JCE 1.2.2 and JSSE 1.0.3
    • Java 1.4
    • Java 1.5

    我已经在吉大正元的eSafe钥匙上通过测试,其他钥匙提供商可以发邮件给我,或者给Usb钥匙我去测试。

    JCAPI的时间限制比较容易去除,但由于JNI层以上的代码做了大量混淆,我不得不重写这个JCE Provider,最起码要实现KeyStoreSpi,SignatureSpi和CipherSpi。

  • JCAPI的JCE Provider我将会在下个月提供

  • posted @ 2006-07-18 12:06 david.turing 阅读(2041) | 评论 (4)编辑 收藏

    BEA AquaLogic Enterprise Security(ALES) 2.2 Released

         摘要:   阅读全文

    posted @ 2006-07-17 22:26 david.turing 阅读(1298) | 评论 (0)编辑 收藏

    发布GIF4J破解版

         摘要: 使用Gif4j实现gif图片的水印嵌入  阅读全文

    posted @ 2006-07-17 10:32 david.turing 阅读(2683) | 评论 (6)编辑 收藏

    Certificate chain received from 客户端- 192.168.10.10 was not trusted causing SSL handshake failure

    SSL握手会有很多意想不到的Exception, 其中很多都是因为没有配置好cacerts导致的。
    以Tomcat为例,你需要在conf/server.xml中指定你的keystore并且配置好KeyAlias,
    同时,Tomcat会到JAVA_HOME/jre/lib/security目录下读取cacerts文件。
    在Weblogic中,你也需要配置Trust.jks和Identity.jks(可以参考WebLoigc Security In Action)。

    问题是,IE究竟根据什么来提交证书(包含私钥的证书)?
    很简单,服务器提交他的证书到客户端,客户端会根据服务器的证书的DN,检索本地私钥,
    选择那些由此DN签发证书X,然后确定使用X对应的本地私钥,用于SSL握手。
    cacerts是JDK容器信任的证书列表,如果cacerts中没有包含客户端私钥对应的证书链中的
    信任证书,则服务器会拒绝任何从客户端的SSL请求。
    典型的Weblogic日志就是:
    <Certificate chain received from 客户端- 192.168.10.10 was not trusted causing SSL handshake failure.>

    posted @ 2006-07-13 17:48 david.turing 阅读(2220) | 评论 (2)编辑 收藏

    How to use Java produce Signature by USBKey under CryptoAPI/CSP

         摘要: How to use Java produce Signature by USBKey under CryptoAPI/CSP.  阅读全文

    posted @ 2006-07-11 13:24 david.turing 阅读(3869) | 评论 (1)编辑 收藏

    Hacking getcsp of pheox

    package com.pheox.jcapi.test;

    import com.pheox.jcapi.CoreSignatureJNI;
    import com.pheox.jcapi.CoreUtilJNI;
    import com.pheox.jcapi.JCAPIJNIException;

    public class getcsp {
     
        public static void main(String[] args) {
         
    //        String g = "MIIDrTCCA2ugAwIBAgICAeYwCwYHKoZIzjgEAwUAMIGQMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEjAQBgNVBAcTCVBhbG8gQWx0bzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxIzAhBgNVBAsTGkphdmEgU29mdHdhcmUgQ29kZSBTaWduaW5nMRwwGgYDVQQDExNKQ0UgQ29kZSBTaWduaW5nIENBMB4XDTA1MDEyMTIyNDc1MloXDTEwMDEyNTIyNDc1MlowVDEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxIzAhBgNVBAsTGkphdmEgU29mdHdhcmUgQ29kZSBTaWduaW5nMQ4wDAYDVQQDEwVQaGVveDCCAbgwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GFAAKBgQD2cHtWHnwO9pOZx9H0uUoLZGKE3iwvVAkUwzVqVEgT4fMG70icn2dII/RABPtXW6Zai87iIg7zC975qeeEznBee7ll/8HFFe8H4IL3tPCf+/TigELMORl3ySd8lzD1mEZMYUL6Rc16T3ZJ3iUxfrJJiN815SZ8qrDkHAtS1Hhot6OBjTCBijARBglghkgBhvhCAQEEBAMCBBAwDgYDVR0PAQH/BAQDAgXgMB0GA1UdDgQWBBRkqtvyzwWOJd+aZikkKKFLDTaqbDAfBgNVHSMEGDAWgBRl4vSGydNO8JFOWKJq9dh4WprBpjAlBgNVHREEHjAcgRp0b21teS5ncmFuZGVmb3JzQHBoZW94LmNvbTALBgcqhkjOOAQDBQADLwAwLAIUdTerIDsy5CLjjPffwoO4rYWZ4kECFAyrKdfe2Qj5T5MWse9EhMD951Wt";

      try {
       System.loadLibrary("JCAPI");
       System.out.println("Load Library Successfully!");
      } catch(UnsatisfiedLinkError e) {

       e.printStackTrace();
      }
      CoreUtilJNI core=new CoreUtilJNI();
      
      String[] mscsp=core.getMSCSP();
      
      for(int i=0;i<mscsp.length;i++)
       System.out.println(mscsp[i]);
      System.out.println("done");
      
      
      String content="1234567890abcdefghij+sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss";
      
      byte[] data = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
      
      data=content.getBytes();
      
      try
            {
                int[] d= CoreSignatureJNI.hashInit("SHA1");
                CoreSignatureJNI.hashUpdate(d, data);
                byte abyte1[] = CoreSignatureJNI.hashFinal(d);
               
                System.out.println(""+new String(abyte1));
                return;
            }
            catch(JCAPIJNIException jcapijniexception)
            {
             jcapijniexception.printStackTrace();
            }
      
      
      
      
      
     }

    }

    posted @ 2006-07-04 22:52 david.turing 阅读(208) | 评论 (3)编辑 收藏

    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION

    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D3B0C4E
    Function=[Unknown.]
    Library=C:\j2sdk1.4.1_02\jre\bin\client\jvm.dll

    NOTE: We are unable to locate the function name symbol for the error
          just occurred. Please refer to release documentation for possible
          reason and solutions.


    Current Java thread:
     at jni.JNIInterface.getPrivateKeyAlias(Native Method)
     at jni.JNIInterface.getRSAPrivateKey(JNIInterface.java:478)
     at jni.ReadCertificates.main(ReadCertificates.java:37)

    Dynamic libraries:
    0x00400000 - 0x00407000  C:\j2sdk1.4.1_02\bin\javaw.exe
    0x77F80000 - 0x77FFC000  C:\WINNT\system32\ntdll.dll
    0x796D0000 - 0x79735000  C:\WINNT\system32\ADVAPI32.dll
    0x77E60000 - 0x77F32000  C:\WINNT\system32\KERNEL32.dll
    0x786F0000 - 0x7875F000  C:\WINNT\system32\RPCRT4.dll
    0x77DF0000 - 0x77E59000  C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000  C:\WINNT\system32\GDI32.dll
    0x78000000 - 0x78045000  C:\WINNT\system32\MSVCRT.dll
    0x75E00000 - 0x75E1A000  C:\WINNT\system32\IMM32.DLL
    0x6C330000 - 0x6C338000  C:\WINNT\system32\LPK.DLL
    0x65D20000 - 0x65D74000  C:\WINNT\system32\USP10.dll
    0x10000000 - 0x1000D000  C:\WINNT\system32\OCMAPIHK.DLL
    0x6D340000 - 0x6D46A000  C:\j2sdk1.4.1_02\jre\bin\client\jvm.dll
    0x77530000 - 0x77560000  C:\WINNT\system32\WINMM.dll
    0x6D1E0000 - 0x6D1E7000  C:\j2sdk1.4.1_02\jre\bin\hpi.dll
    0x6D310000 - 0x6D31E000  C:\j2sdk1.4.1_02\jre\bin\verify.dll
    0x6D220000 - 0x6D239000  C:\j2sdk1.4.1_02\jre\bin\java.dll
    0x6D330000 - 0x6D33D000  C:\j2sdk1.4.1_02\jre\bin\zip.dll
    0x0AC90000 - 0x0ACA0000  D:\JavaSource\SecureX\jnicert.dll
    0x768D0000 - 0x768FB000  C:\WINNT\system32\WINTRUST.dll
    0x79C40000 - 0x79CCC000  C:\WINNT\system32\CRYPT32.dll
    0x773F0000 - 0x77401000  C:\WINNT\system32\MSASN1.dll
    0x77900000 - 0x77923000  C:\WINNT\system32\IMAGEHLP.dll
    0x7CF00000 - 0x7CFEF000  C:\WINNT\system32\ole32.dll
    0x7CEA0000 - 0x7CEF3000  C:\WINNT\system32\NETAPI32.dll
    0x77960000 - 0x77984000  C:\WINNT\system32\DNSAPI.dll
    0x74FD0000 - 0x74FDA000  C:\WINNT\system32\WSOCK32.dll
    0x74FB0000 - 0x74FC4000  C:\WINNT\system32\WS2_32.DLL
    0x74FA0000 - 0x74FA8000  C:\WINNT\system32\WS2HELP.DLL
    0x75150000 - 0x75156000  C:\WINNT\system32\NETRAP.dll
    0x77BD0000 - 0x77BE1000  C:\WINNT\system32\NTDSAPI.dll
    0x77930000 - 0x7795B000  C:\WINNT\system32\WLDAP32.DLL
    0x797B0000 - 0x797BF000  C:\WINNT\system32\SECUR32.DLL
    0x750E0000 - 0x750F0000  C:\WINNT\system32\SAMLIB.dll
    0x79C00000 - 0x79C13000  C:\WINNT\system32\cryptnet.dll
    0x687E0000 - 0x687EB000  C:\WINNT\system32\PSAPI.DLL
    0x75A50000 - 0x75A55000  C:\WINNT\system32\SensApi.dll
    0x772A0000 - 0x77306000  C:\WINNT\system32\SHLWAPI.dll
    0x794D0000 - 0x79534000  C:\WINNT\system32\USERENV.dll
    0x4FF90000 - 0x4FFE4000  C:\WINNT\system32\WINHTTP.dll
    0x758E0000 - 0x7594F000  C:\WINNT\system32\cryptui.dll
    0x71710000 - 0x71794000  C:\WINNT\system32\COMCTL32.dll
    0x63000000 - 0x63095000  C:\WINNT\system32\wininet.dll
    0x77990000 - 0x77A2B000  C:\WINNT\system32\OLEAUT32.dll
    0x7CA00000 - 0x7CA23000  C:\WINNT\system32\rsaenh.dll
    0x72960000 - 0x7298D000  C:\WINNT\system32\DBGHELP.dll

    Local Time = Fri Jun 30 17:17:50 2006
    Elapsed Time = 5
    #
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002E6
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    #
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode)
    #
    # An error report file has been saved as hs_err_pid2024.log.
    # Please refer to the file for further information.
    #


    It happens when I want to call the CryptoAPI through JNI, Can anyone give some advice?

    posted @ 2006-06-30 17:19 david.turing 阅读(4067) | 评论 (1)编辑 收藏

    接受广州电台新闻风云榜[FM96.2]记者钟慧的个人采访

    今天运气很好,被广州电台新闻风云榜记者钟慧采访了,并且领取了Team5 Hair Salon的洗头礼券。钟慧是一个很Nice and Pretty的女孩,如果我没google错,她应该来自于中山大学国际法的05届研究生,呵呵。女研究生俺还是有能力去应付的......
    新闻风云榜》是一个娱乐化包装的新闻节目(6:30pm-7:00pm),是广州电台一台就转型打造成新闻资讯广播的重要节目。
    对于现代的IT人,繁忙的工作后,经常需要吸收一些社会新闻信息,有两个非常棒的悠闲节目,一个是广州电视台的《新闻日日睇》和广州电台的《新闻风云榜》。

    我回忆了几个采访片断:

    钟慧:对新闻风云榜的看法
    我:很不错,能接受众多群众的反馈和观点,下一个陈扬节目。

    钟慧:觉得新闻风云榜有什么可以改进的地方
    我:已经很好,该节目有潜力,将会越来越好,但需要处理好中立的观点立场,观点不要过于偏激;同时,要大胆一些,敢于接受批评,正面观点固然需要,但也不要拒绝持对立观点的听众的意见,否则媒体的中立立场就缺乏前提条件了: )

    钟慧:昨天你在电台类比黄建翔的“意大利万岁”成“国民党万岁”,给我们造成了不少压力,我们都被批评了。
    我:我觉得我的表达有问题,我可能口快说错了(附:当时我打电话去新闻风云榜,发表我对黄建翔作为一个中央台解说员发表过激观点的非理性,我的观点当然不是“国民党万岁”,而是用“国民党万岁”来类比黄建翔观点的偏激性,在此,我再次澄清我的观点,如果你是一个台湾选民,你可能会呼喊“国民党万岁”或者“民进党万岁”,你有这样的权利,但黄建翔当时的角色不是一个“选民”,他难道没有想到电视观众中有“澳大利亚万岁”的球迷?仅代表个人观点和立场,并希望用此类比批评黄健翔做法的不适时性,并非批评黄健翔的个人品质问题。

    除了对我的采访被她录音了,我也录了音,真不错,想不到《新闻风云榜》的节目组会这么榜,现在收听率已经升至本地区中游,FM96.2,作为我自己,下班时候(6点到6点半)可以听听电台,偶尔还可以发表一下言论,而且还能听到别人的观点和发表自己的观点,真是件快事。

    posted @ 2006-06-28 23:42 david.turing 阅读(1799) | 评论 (11)编辑 收藏

    A Java Sample For jCaptcha

         摘要: 一个简单的jcaptcha例子  阅读全文

    posted @ 2006-06-20 22:10 david.turing 阅读(1754) | 评论 (1)编辑 收藏

    GZUG之Captcha深度对抗比赛开始

    Captcha项目是Completely Automated Public Turing Test to Tell Computers and Humans Apart (全自动区分计算机和人类的图灵测试)的简称。
    CAPTCHA的目的是区分计算机和人类的一种程序算法,这种程序必须能生成并评价人类能很容易通过但计算机却通不过的测试。这个要求本身就是悖论,因为这意味着一个CAPTCHA必须能生成一个它自己不能通过的测试。
    大家可以看看CAPTCHA的一个例子

    人类能够比较容易识别图片中的字母,但如果编写计算机程序,难度就非常大了。
    按照Lenore Blum的说法,任何的图片中的内容都能被识别,不存在一种计算程序生成的图片不能被计算机程序识别出来。
    于是,比赛开始了,有人站到Captcha一方,有人站到破译Captcha的一方.......

    如今,GZUG的两位牛人已经开始了这个游戏,有兴趣的朋友请加入到我们的对抗比赛(QQ群:16699048):

    CYT(Coremail的主要设计者)加入了Captcha一方。
    灵感之源 (Guardio/Definio的Designer)加入了破译Captcha的一方。

    游戏规则是:Captcha方公布一系列的图片,破译Captcha的一方提供程序能够分析这些图片中的内容,如果破译方提供的应用程序能够以高于10%的识别率识别出图片内容,则判定破译方获胜。获胜方将得到BEA UG礼品一份!

    游戏奖品参见:
    http://dev2dev.bea.com.cn/bbs/gift!default.jspa

    关于Captcha的信息,参考下面的链接
    Captcha方:
    Captcha项目:http://www.captcha.net/
    jCaptcha项目:http://jcaptcha.sourceforge.net/

    破译Captcha方:
    http://www.cs.sfu.ca/~mori/research/gimpy/
    http://sam.zoy.org/pwntcha/
    http://www.brains-n-brawn.com/default.aspx?vDir=aicaptcha

    posted @ 2006-06-19 12:41 david.turing 阅读(1874) | 评论 (0)编辑 收藏

    BEA广州UserGroup6月3日活动手札

         摘要: 第三次BEA UserGroup总结  阅读全文

    posted @ 2006-06-16 01:10 david.turing 阅读(1440) | 评论 (2)编辑 收藏

    [广州UserGroup公告] 永远怀念广州康祈宗

    郭昶,康祈宗,我谨代表广州UserGroup永远怀念你,你很出色,你已经深深印入我们的脑海!

    郭昶扮演的康祈宗是《外来媳妇本地郎》最搞笑的角色,而郭昶本人与剧中角色反差很大,剧中的康祈宗,市侩狡猾,追名逐利,郭昶本人则称自己对名利看得不重,认为自己只是一名普通的演员,拍戏空闲时,喜欢独处,潜心研究角色。

        郭昶认为对艺术的态度要精益求精,这样才能做到每一个环节都不能让人看出破绽,他说:“我是一个有什么说什么的人,所谓明星,只不过是给你一个定位,演员只是一个职业,与工人、医生没什么区别,如果把自己定位为明星,那就大错特错。”



    姓名 : 郭昶
    英文名 : guochang
    性别 : 男
    年龄 : 45
    身高 : 173
    体重 : 55
    三围 : --
    星座 : 天歇座
    所在省份 : 广东
    职业 : 演艺业
    演出经验 :
    从艺十五年,经验丰富,受广大观众欢迎。
    幕后工作经验 :
    导演,副导演,编剧,剧务等等卖力的工作。
    生日日期 : 10月1日xxxx年
    出生地点 : 沈阳
    家庭成员 : 妻子,女儿
    所懂语言 : 普通话,粤语
    教育水平 : 初中
    收入水平 : 1001-2000
    最想告诉大家的特别事情 : 一分耕耘,一分收获
    自我推荐 :
    瘦高,人又老,又黑又瘦,又鞋揪。
    我的兴趣 :
    娱乐活动, 旅行, 演戏, 户外活动, 阅读, 广泛
    我的专长 :
    语言天才, 演戏, 文学创作, 样样专
    我最想加入的行列 :
    演员, 导演, 有钱就行

    posted @ 2006-06-15 20:09 david.turing 阅读(440) | 评论 (1)编辑 收藏

    挑战随机序列---悬赏破解基于PRNG的Hacker

         摘要: 本文设计了一个Java的随机序列,在此基础上产生了一个数字水印,并提供了水印图片,悬赏能破解水印信息的破解者。  阅读全文

    posted @ 2006-06-13 09:44 david.turing 阅读(2097) | 评论 (5)编辑 收藏

    第三次BEA UG活动讲义下载

         摘要: 第三次UG安全研讨会讲义下载  阅读全文

    posted @ 2006-06-12 13:13 david.turing 阅读(1419) | 评论 (3)编辑 收藏

    向全体奥一网球迷的致歉信

    全体奥一网球迷:
            最近,奥一网的"讲波佬"评选中,我们分别设计了针对罗荣满的投票机程序(for .net和for Java),该程序可能在网上被滥用而导致极个别人选票数非正常变动,对此,我们感到非常非常抱歉。
            最初,我们编写投票机纯粹是出于对已故的罗指导(罗荣满)的深切缅怀,希望借世界杯之际,怀念一下已故的人。但这件事发生之后,我们的行为遭到广泛的批评,经过仔细思考,我们发现我们的最初的想法非常不成熟,有可能对参与投票的其他网友做成困扰,对此我们表示深切的内疚。
            我们是广州的老球迷并一直怀念着那些属于广州足球的光荣岁月,我们非常欣赏每一个讲波佬,事实上,他们都非常专业以及具备非常独特的讲波艺术,进入了讲波评选的讲波佬,证明他们已经得到广泛球迷的认同。
            这次我们的投票行为给贵站和其他工作人员做成了不便,我们希望能得到你们的谅解。我们已经在所有网站和BBS上删除了设计投票机的源代码和程序,并愿意提供一切必要的手段(包括技术手段)弥补已造成的影响。

                                                                                                                                                                                                               

    灵感之源(http://unruledboy.cnblogs.com/)
    David.Turing(http://openssl.blogjava.net)
    Timill(http://blog.csdn.net/timiil/)

    posted @ 2006-06-11 20:53 david.turing 阅读(109) | 评论 (0)编辑 收藏

    PNG头文件格式分析

    00000000h: 89 50 4E 47 0D 0A 1A 0A00 00 00 0D49 48 44 52 ; 塒NG........IHDR
    00000010h: 00 00 00 CE 00 00 00 CE 08 02 00 00 00 F9 7D AA ; ...?..?....鶀?
    00000020h: 93 00 00 00 09 70 48 59 73 00 00 0A 75 00 00 0A ; ?...pHYs...u...
    00000030h: 75 01 4A 25 DD FD 00 00 0C 91 49 44 41 54 78 9C ; u.J%蔟...慖DATx?
    00000040h: ED 9D D9 96 DC 2A 0C 45 A9 AC FC FF 2F D7 7D 70 ; 頋贃?.E┈?/讅p
    00000050h: C7 97 66 10 9A 98 CF 7E C8 EA 54 95 6D 86 83 24 ; 菞f.殬蟸汝T昺唭$
    00000060h: 04 B6 3F DF EF 37 00 D0 9F 3F B3 0B 00 6E 01 52 ; .?唢7.袩??.n.R
    00000070h: 03 83 F8 3B BB 00 AB F2 F9 98 0E 47 58 92 01 A9 ; .凐;?鶚.GX??



    89 50 4E 47 0D 0A 1A 0A 是PNG头部署名域,表示这是一个PNG图片
    00 00 00 0D 描述IHDR头部的大小
    49 48 44 52Chunk Type Code, 这里Chunk Type Code=IHDR
    00 00 00 CE 00 00 00 CE 08 02 00 00 00 描述了Chunk Data,它是可变长度数据00 00 00 0D 定义了长度为13个Bytes,所以,这里,你看到是13个字节)
    F9 7D AA 93 是对IHDR的CRC校验

    紧接着下面的就是pHys数据块,原理也是一样。


    posted @ 2006-06-08 11:39 david.turing 阅读(746) | 评论 (1)编辑 收藏

    Java处理Gif图片

    http://www.gurge.com/amd/old/java/GIFEncoder/index.html

    posted @ 2006-06-06 22:32 david.turing 阅读(2009) | 评论 (4)编辑 收藏

    java处理PNG图像(转载WikiMedia)

    http://catcode.com/pngencoder/

    http://prdownloads.sourceforge.net/javapng/javapng-2.0-rc4-src.jar?download



    PNG格式
    PNG是20世纪90年代中期开始开发的图像文件存储格式,其目的是企图替代GIF和TIFF文件格式,同时增加一些GIF文件格式所不具备的特性。流式网络图形格式(Portable Network Graphic Format,PNG)名称来源于非官方的“PNG's Not GIF”,是一种位图文件(bitmap file)存储格式,读成“ping”。PNG用来存储灰度图像时,灰度图像的深度可多到16位,存储彩色图像时,彩色图像的深度可多到48位,并且还可存储多到16位的α通道数据。PNG使用从LZ77派生的无损数据压缩算法。

    PNG文件格式保留GIF文件格式的下列特性:

    使用彩色查找表或者叫做调色板可支持256种颜色的彩色图像。

    流式读/写性能(streamability):图像文件格式允许连续读出和写入图像数据,这个特性很适合于在通信过程中生成和显示图像。

    逐次逼近显示(progressive display):这种特性可使在通信链路上传输图像文件的同时就在终端上显示图像,把整个轮廓显示出来之后逐步显示图像的细节,也就是先用低分辨率显示图像,然后逐步提高它的分辨率。

    透明性(transparency):这个性能可使图像中某些部分不显示出来,用来创建一些有特色的图像。

    辅助信息(ancillary information):这个特性可用来在图像文件中存储一些文本注释信息。

    独立于计算机软硬件环境。

    使用无损压缩。

    PNG文件格式中要增加下列GIF文件格式所没有的特性:

    每个像素为48位的真彩色图像。

    每个像素为16位的灰度图像。

    可为灰度图和真彩色图添加α通道。

    添加图像的γ信息。

    使用循环冗余码(cyclic redundancy code,CRC)检测损害的文件。

    加快图像显示的逐次逼近显示方式。

    标准的读/写工具包。

    可在一个文件中存储多幅图像。

    文件结构

    PNG图像格式文件(或者称为数据流)由一个8字节的PNG文件署名(PNG file signature)域和按照特定结构组织的3个以上的数据块(chunk)组成。

    PNG定义了两种类型的数据块,一种是称为关键数据块(critical chunk),这是标准的数据块,另一种叫做辅助数据块(ancillary chunks),这是可选的数据块。关键数据块定义了4个标准数据块,每个PNG文件都必须包含它们,PNG读写软件也都必须要支持这些数据块。虽然PNG文件规范没有要求PNG编译码器对可选数据块进行编码和译码,但规范提倡支持可选数据块。

    (1) PNG文件署名域

    8字节的PNG文件署名域用来识别该文件是不是PNG文件。该域的值是:

    十进制数 137 80 78 71 13 10 26 10
    十六进制数 89 50 4e 47 0d 0a 1a 0a

     

    (2) 数据块的结构

    每个数据块都由表6-07所示的的4个域组成。

    表6-07 PNG文件数据块的结构

    名称

    字节数

    说明

    Length(长度) 4字节 指定数据块中数据域的长度,其长度不超过
    (231-1)字节
    Chunk Type Code(数据块类型码) 4字节 数据块类型码由ASCII字母(A-Z和a-z)组成
    Chunk Data(数据块数据) 可变长度 存储按照Chunk Type Code指定的数据
    CRC(循环冗余检测) 4字节 存储用来检测是否有错误的循环冗余码

     

    在表6-07中,CRC(cyclic redundancy check)域中的值是对Chunk Type Code域和Chunk Data域中的数据进行计算得到的。CRC具体算法定义在ISO 3309和ITU-T V.42中,其值按下面的CRC码生成多项式进行计算:

    x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

    数据块结构

    1. 关键数据块

    关键数据块中的4个标准数据块是:

    (1) 文件头数据块IHDR(header chunk):它包含有PNG文件中存储的图像数据的基本信息,并要作为第一个数据块出现在PNG数据流中,而且一个PNG数据流中只能有一个文件头数据块。

    文件头数据块由13字节组成,它的格式如表6-08所示。

    表6-08 PNG文件头键数据块的结构

    域的名称

    字节数

    说明

    Width 4 bytes 图像宽度,以像素为单位
    Height 4 bytes 图像高度,以像素为单位
    Bit depth 1 byte 图像深度:
    索引彩色图像:1,2,4或8
    灰度图像:1,2,4,8或16
    真彩色图像:8或16
    ColorType 1 byte 颜色类型:
    0:灰度图像, 1,2,4,8或16
    2:真彩色图像,8或16
    3:索引彩色图像,1,2,4或8

    4:带α通道数据的灰度图像,8或16
    6:带α通道数据的真彩色图像,8或16

    Compression method 1 byte 压缩方法(LZ77派生算法)
    Filter method 1 byte 滤波器方法
    Interlace method 1 byte 隔行扫描方法:

    0:非隔行扫描

    1: Adam7(由Adam M. Costello开发的7
    遍隔行扫描方法)

     

    (2) 调色板数据块PLTE(palette chunk):它包含有与索引彩色图像((indexed-color image))相关的彩色变换数据,它仅与索引彩色图像有关,而且要放在图像数据块(image data chunk)之前。真彩色的PNG数据流也可以有调色板数据块,目的是便于非真彩色显示程序用它来量化图像数据,从而显示该图像。调色板数据块结构如表6-09所示。

    表6-09 调色板数据块结构

    域的名称

    字节数

    说明

    Red 1 byte 0 = 黑,255 = 红
    Green ">

    0 = 黑,255 = 绿

    Blue 1 byte 0 = 黑,255 = 蓝

     

    调色板实际是一个彩色索引查找表,它的表项数目可以是1~256中的一个数,每个表项有3字节,因此调色板数据块所包含的最大字节数为768。

    (3) 图像数据块IDAT(image data chunk):它存储实际的数据,在数据流中可包含多个连续顺序的图像数据块。

    (4) 图像结束数据IEND(image trailer chunk):它用来标记PNG文件或者数据流已经结束,并且必须要放在文件的尾部。

    除了表示数据块开始的IHDR必须放在最前面, 表示PNG文件结束的IEND数据块放在最后面之外,其他数据块的存放顺序没有限制。

    2. 辅助数据块

    PNG文件格式规范制定的10个辅助数据块是:

    (1) 背景颜色数据块bKGD(background color)。

    (2) 基色和白色度数据块cHRM(primary chromaticities and white point)。所谓白色度是指当R=G=B=最大值时在显示器上产生的白色度。

    (3) 图像γ数据块gAMA(image gamma)。

    (4) 图像直方图数据块hIST(image histogram)。

    (5) 物理像素尺寸数据块pHYs(physical pixel dimensions)。

    (6) 样本有效位数据块sBIT(significant bits)。

    (7) 文本信息数据块tEXt(textual data)。

    (8) 图像最后修改时间数据块tIME (image last-modification time)。

    (9) 图像透明数据块tRNS (transparency)。

    (10) 压缩文本数据块zTXt (compressed textual data)。

    3. 数据块摘要

    关键数据块、辅助数据块和专用公共数据块(special-purpose public chunks)综合在表6-10中。

    表6-10 PNG文件格式中的数据块

    数据块符号

    数据块名称

    多数据块

    可选否

    位置限制

    IHDR 文件头数据块

    第一块
    cHRM 基色和白色点数据块

    在PLTE和IDAT之前
    gAMA 图像γ数据块

    在PLTE和IDAT之前
    sBIT 样本有效位数据块

    在PLTE和IDAT之前
    PLTE 调色板数据块

    在IDAT之前
    bKGD 背景颜色数据块

    在PLTE之后IDAT之前
    hIST 图像直方图数据块

    在PLTE之后IDAT之前
    tRNS 图像透明数据块

    在PLTE之后IDAT之前
    oFFs (专用公共数据块)

    在IDAT之前
    pHYs 物理像素尺寸数据块

    在IDAT之前
    sCAL (专用公共数据块)

    在IDAT之前
    IDAT 图像数据块

    与其他IDAT连续
    tIME 图像最后修改时间数据块

    无限制
    tEXt 文本信息数据块

    无限制
    zTXt 压缩文本数据块

    无限制
    fRAc (专用公共数据块)

    无限制
    gIFg (专用公共数据块)

    无限制
    gIFt (专用公共数据块)

    无限制
    gIFx (专用公共数据块)

    无限制
    IEND 图像结束数据

    最后一个数据块

     

    tEXt和zTXt数据块中的标准关键字:

    Title

    图像名称或者标题

    Author

    图像作者名

    Description

    图像说明

    Copyright

    版权声明

    CreationTime

    原图创作时间

    Software

    创作图像使用的软件

    Disclaimer

    弃权

    Warning

    图像内容警告

    Source

    创作图像使用的设备

    Comment

    各种注释

    posted @ 2006-06-06 22:17 david.turing 阅读(1044) | 评论 (0)编辑 收藏

    Java读取BMP文件

    各位老大,帮我看看代码

             //  The DataInputStream allows you to read in 16 and 32 bit numbers
            DataInputStream in  =   new  DataInputStream(instream);
            DataOutputStream out
    = new  DataOutputStream(outstream);

            
    //  Verify that the header starts with 'BM'
             if  (in.read()  !=   ' B ' {
                
    throw   new  IOException( " Not a .BMP file " );
            }

            out.write(
    ' B ' );
            
            
    if  (in.read()  !=   ' M ' {
                
    throw   new  IOException( " Not a .BMP file " );
            }

            out.write(
    ' M ' );
            
            
    //      Get the total file size
             int  fileSize  =  intelInt(in.readInt());
            out.writeInt(intelInt(fileSize));

            
    //      Skip the 2 16-bit reserved words
            out.writeShort(in.readUnsignedShort());
            out.writeShort(in.readUnsignedShort());

            
    int  bitmapOffset  =  intelInt(in.readInt());
            out.writeInt(intelInt(bitmapOffset));
            
    int  bitmapInfoSize  =  intelInt(in.readInt());
            out.writeInt(intelInt(bitmapInfoSize));
            
            
    int  width  =  intelInt(in.readInt());
            out.writeInt(intelInt(width));
            
    int  height  =  intelInt(in.readInt());
            out.writeInt(intelInt(height));
            
    //  Skip the 16-bit bitplane size
            out.writeShort(in.readUnsignedShort());
            
    int  bitCount  =  intelShort(in.readUnsignedShort());
            out.writeShort(intelShort(bitCount));
            
    int  compressionType  =  intelInt(in.readInt());
            out.writeInt(intelInt(compressionType));
            
    int  imageSize  =  intelInt(in.readInt());
            out.writeInt(intelInt(imageSize));
    //  Skip pixels per meter
            out.writeInt(in.readInt());
            out.writeInt(in.readInt());

            
    int  colorsUsed  =  intelInt(in.readInt());
            out.writeInt(intelInt(colorsUsed));
            
    int  colorsImportant  =  intelInt(in.readInt());
            out.writeInt(intelInt(colorsImportant));
            System.out.println(
    " [colorused]= " + colorsUsed);

    //  Read the pixels from the stream based on the compression type
             if  (compressionType  ==  BI_RGB)  {
                
    if  (bitCount  ==   24 {
                    readRGB24(width, height, in, out);
                }

            }
     
        }


         protected   static   void  readRGB24( int  width,  int  height,
            DataInputStream in, OutputStream out)
        
    throws  IOException
        
    {

    //  Start storing at the bottom of the array
             for  ( int  h  =  height - 1 ; h  >=   0 ; h -- {
             
    for  ( int  w  =   0 ; w  <  width; w ++ {

    //  Read in the red, green, and blue components
               int  red  =  in.read();
              
    int  green  =  in.read();
              
    int  blue  =  in.read();
              out.write(red);
              out.write(green);
              out.write(blue);
                }

            }

        }

    posted @ 2006-06-06 10:29 david.turing 阅读(597) | 评论 (2)编辑 收藏

    组织去越秀山看球(广州队vs南京队)

    小白带队,Timiil负责帮大家订票,报名从速。
    时间地点: 本周四傍晚,越秀山.

    posted @ 2006-06-05 15:33 david.turing 阅读(341) | 评论 (3)编辑 收藏

    Java对BMP图像处理

    Windows位图(windows上位图是little endian)由四部分组成:
    A.1,位图文件头部
    A.2,位图信息头部
    A.3,颜色表
    A.4,位图的内容(位图由大量的bit组成)

    下表来自HackJava,它描述了A1的结构
    # of Bytes
    TypeDescription
    2
    Character 文件类型,通常是BM开头
    4
    32-bit Int 文件大小,单位byte
    2
    16-bit Int 保留
    2
    16-bit Int 保留
    4
    32-bit Int 位图内容(A.4)开始的字节偏移


    A.2部分的结构如下
    # of Bytes
    TypeDescription
    4
    32-bit Int 信息头的大小(字节数)
    4
    32-bit Int 位图的宽度(如1024像素)
    4
    32-bit Int 位图的高度(如768像素)
    2
    16-bit Int Number of bitplanes (should be 1)
    2
    16-bit Int 用多少个位去描述一个像素(1, 4, 8, or 24)
    4
    32-bit Int 使用的压缩类型
    4
    32-bit Int 如果使用了压缩,需要指定位图的实际大小
    4
    32-bit Int 每米的水平像素的数量(用于放大缩小) 
    4
    32-bit Int 每米的垂直像素的数量(用于放大缩小) 
    4
    32-bit Int 实际用到的颜色数量
    4
    32-bit Int 较重要颜色的数量(用于减少颜色数)

    posted @ 2006-06-05 08:59 david.turing 阅读(1893) | 评论 (0)编辑 收藏

    0Day FTP服务器帐号密码

    -----BEGIN PGP MESSAGE-----
    Version: PGP Desktop 9.0.5 - Enterprise license

    qANQR1DBwEwDOgsSuXd//TEBB/9u6juG8R0ufJTe772f29JFGnMYhYvCNzIo5ei+
    GDkJXZbyMUgbeQc8scjWItoquiZ7+I2nHBwvlP9bgwpkVIn7spaJLm9uaGvz4u4n
    WVWSQfFFn2nl2tAQN5cRNhD3rzSP6zQPnDRELcNEz4JwfXYiApYcImUTQZh79Mhn
    PX87OqjH+66KpcNTomDsKcgjnZaDJUrKiJ7PVavMWn++SnIPaoGbzODnzRauaCNP
    1dUa2ia493Xja1gNqnQoSfLAVG4MsUFe4qKOn35eWtiVYFH8AoNrIlaW6XYPl9FR
    iqmkOxycGXgnt3zh2zO4uSD77ifsNkZ13uLSupwNIbiIMIIGwcFOAwf8TMrgt1+u
    EAgAhsbiaHkva437hPcE9wJpzCadXbn62/6NpOK/P6Mr6IabFYuePOJf43aI6Uy1
    4PMX/cVWtUbD3nF1Ntal8JtFaH4yUdr5WPvVxaQnzngZ304Nf6fO10VQT9jN3Eu5
    0FVsJ2CjetY4fV+ORdyvWJR7sl09cZ+n/1MrBh2L3zco+6vC8zPKKhygLiP6Hw00
    A/LBf1G6MLSzbqrr3p/uURgju6uF3nlW5BuxM1pXRVMeNPQLGnR931dX6UukPtzm
    L5pl1jNqNQ1uMtWdMHXKmr+jdAvsxae/cqOil+6zMMhh2RFmE1i3CGEXuWl4cX/M
    hLB/diRXIwZviS9w1IGC5ZkXMggA3UX56R/EZlSwPnj7h8XlG4Ikb0hV9acD0Mv2
    FIHOMZBJZHyHJcEV+RjwTy+rCpWp7sUQ0a7scQgZeeleJjJ0duzDKFAPhTAkFsVi
    pkgHD30zHSJ8142XdbSgYSYR8wKo4xADPmaGTOnml0Y2tBhdL3c9KyfHcfigM3b9
    AQ8zLrGSgjHJ/nh+Xltv6wESjg1n+gPIiPwab71z2asEyPAebMw/61Am7hxVPxLs
    EqHI0QLTFiS6FvphUzhLDlfoztWNB+FgAiD1SKb0UzCDF76wTsvuIHjpPFcfbCIf
    GCd7sBc8++eGmiyIOghw/HANYCyhgWNyhgsXeMYIZ81o1xGcN8k641c2LI0ZANeW
    g5TWluOjysejDyLv7hOS6kVCKcBW+B6mv8sb1X4RacuBM9TTRWgsOMJHQEybStBV
    zg==
    =joRo
    -----END PGP MESSAGE-----

    posted @ 2006-06-04 23:22 david.turing 阅读(5908) | 评论 (8)编辑 收藏

    在UserGroup上面开了一个玩笑,有点后悔

    Ø 我在UserGroup上面开了一个RSA的玩笑,我当时提问一个很简单的问题:
    RSA跟断背山的关系。
    RSA如下:
    A : private Key + public Key

    Ø B : private Key + public Key
    Ø
    A对B share
     public key 
    B对A  share public key
    断背山.jpg

    紧接着A->B
    B-〉A


    因为当时看到在场的人都不太理解公钥私钥,情急智生,做了一个类比,现在回头想,有点过分了。

    posted @ 2006-06-04 12:17 david.turing 阅读(634) | 评论 (2)编辑 收藏

    第三次BEA UserGroup广州大学城活动(6月3日,包车往返,体育中心出发,包午餐)

         摘要:   阅读全文

    posted @ 2006-05-29 13:50 david.turing 阅读(2449) | 评论 (4)编辑 收藏

    CAS协议的抓包分析

         摘要: CAS抓包分析,简单看看从login到serviceValidate的参数传递过程  阅读全文

    posted @ 2006-05-26 11:27 david.turing 阅读(2581) | 评论 (0)编辑 收藏

    操作图像的Java类库集合(来自schmidt.devlib.org)

    Library / package License Description
    AC.lib ICO - Java library for ICO files Freeware Read Microsoft Windows ICO files. Supports the javax.imageio framework, but the library can also be used from older (pre 1.4) Java runtime environments.
    ACME Java code Special license on the website. Read PPM (Portable PixMap), write GIF and PPM.
    AutoVue for Java Commercial Various raster image file formats, including TIFF.
    Batik Apache Software License 1.1 The Batik toolkit also contains image I/O packages below the org.apache.batik.ext.awt.image.codec hierarchy. Read and write PNG and TIFF.
    BMP Library Free for personal use. Read BMP files with 1, 8 or 24 bits, write BMP files with 24 bits. A demo viewer and documentation are included.
    BMP loader Unknown to me. Read Windows BMP files. This one comes with a nice introduction one how to deal with images in Java.
    BMP Read Sample None specified. BMP loader, includes sample application.
    BMPFile None specified. Javaworld.com tip 60. Write Windows BMP files.
    BMS Java Imaging Viewer (JIVe) Commercial Supports MO:DCA (IOCA [CCITT G3,G4, G4-MMR & JPEG encoding] and PTOCA), AFP (LIST3820), TIFF (various compression types), ASCII, EBCDIC, BMP, GIF, JPEG.
    DICOM Image I/O plugin Commercial, evaluation version available. Read and write DICOM image files. Uses the ImageIO API which has been introduced with Java 1.4.
    FFMTIFF Commercial Supports TIFF Group 4 decoding. Seems to be tested with all kinds of browsers on different platforms to be used in an applet.
    FM Software GifDecoder, AnimatedGifEncoder Freeware Read and write one image and animated GIF. Includes a high quality color quantizer (a port of NeuQuant to Java) to reduce truecolor to palette images. A class to read uncompressed and RLE-compressed PSD files (Photoshop) was recently added.
    GIF decoder and encoder Free Read RLE GIF files. RLE (runlength encoding) will result in larger files compared to standard LZW GIFs, but has not the patent problems of LZW. The corresponding encoder was never completed, and the author does not intend to do so in the future.
    GIF encoder ? A GIF encoder, plus an implementation of an Octree color quantizer to reduce the number of colors, as GIF only supports up to 256 different colors in an image.
    Gif4J Commercial (PRO and LIGHT versions) Read and write GIF files. Supports creation of animations including color image quantization, text rendering etc. Offers several image editing algorithms, adding comments and watermarking GIFs (watermarking here means adding images on top of other images, not adding information to identify stolen images).
    GIF89Encoder Public Domain Based on the ACME encoder, this package offers more features, including encoding of animated GIFs and textual comments. Source code included.
    GIFImage Apache License Write one-image and animated GIF files. Supports transpareny. Comes with source code.
    GIFOutputStream.java Free for non-commercial use. Write GIF files.
    IBM alphaWorks IBM Internet License Agreement See the Image Conversion section, it has code to read and write Windows BMP files.
    ICJ (Image Converters for Java) Commercial Supports reading and writing of JPEG, PNG, BMP, GIF and PCX as well as dithering (presumably in combination with color quantization).
    ICOReader LGPL Read Windows icon files (.ico). To be used as part of the ImageIO framework, requires Java 1.4+.
    Image Saving Toolkit for Java Images(JVG/JIS) LGPL Write PNG, PICT, BMP, TIFF, TGA. Reads some of those as well. Class library and Java Beans. Seems to come with its own JPEG encoder, independent of IJG code.
    Image/J Free for non-commercial use. Read and write GIF, TIFF, JPEG. Read BMP, DICOM, FITS and PGM.
    ImageGear Commercial Read and write various formats, including TIFF, BMP, MO:DCA, IOCA and CALS.
    ImageroReader Free for non-commercial use. Read BMP, TGA, TIFF, PNG, JNG, MNG, JPEG, CRW, PSD, GIF and MRW. Read thumbnails and metadata from those formats. Read thumbnails from THM. Read all embedded images from EPS files.
    ImageToGif Freeware [Page is gone; I'm trying to find the author] Saves an Image instance as a GIF file. No source code is provided.
    ImageToolz ? Read and write PPM and Windows BMP files. Also can load GIF and JPG via Toolkit. Uses the Obrador codec to write JPEGs. Comes with source code.
    JAI (Java Advanced Imaging) Sun license. An image processing toolkit; Sun also provides the source code for the 1.0 image codecs. There is a page dedicated to image I/O issues.
    Java Advanced Imaging Image I/O API Sun license. Reader-writer plug-ins for the 1.4+ javax.imageio package. Supported: BMP, JPEG, JPEG 2000, PNG, PNM, Raw, TIFF, and WBMP image formats.
    Java Image Loader LGPL Image reading that is fast (using native code via JNI) and uses relatively little memory for GIF, JPEG, PNG (1.0), TIFF, TGA, BMP and XPM/XBM. Seems to work under Win32 only at the moment, but uses free, well-tested standard libraries like IJG, libtiff, libpng etc. which work under many platforms and are relatively easy to port to new ones.
    JavaPNG LGPL Read PNG (Portable Network Graphics) files.
    JDDK (Java DICOM Development Kit) Commercial library, 30 day trial version. Read and write DICOM, the file format for medial images.
    JIMI Sun Binary Code License Agreement Sun development kit to read and write several formats, including GIF, JPEG, TIFF, PNG, PICT, PSD, BMP, TGA, ICO, CUR, RAS, XBM, XPM and PCX.
    JIU—Java Imaging Utilities GPL Java imaging library with support for PNG, GIF, IFF, RAS, PCD, PBM/PGM/PPM/PNM, PSD, TIFF (uncompressed, PackBits, Deflate, CCITT-1D, LogLuv).
    JJ2000 ? An implementation of the JPEG 2000 image compression standard.
    JMagick LGPL A wrapper to the functionality of ImageMagick, a powerful free imaging library (supported formats). JNI is used to access native code (written in C).
    JPEG baseline decoder and encoder Special license at the beginning of each source code file. Read and write JPEG files.
    JPEG baseline encoder Commercial (previously freeware) Write JPEG files.
    New entry jrawio MIT License Read various RAW formats of digital cameras like Nikon's NEF or CRW/CR2 with Canon. Pure Java code.
    LizardWorks TIFF library (L)GPL Read TIFF (Tagged Image File Format) files. Some files of the toolkit seem to be under the GPL, others under the LGPL.
    LONI Java Image I/O Plugins LGPL Read and write DICOM, ECAT, GE, MINC, AFNI, ANALYZE, and NIFTI (medical image file formats).
    LuraWave Java SDK Commercial Read and write LuraTech's proprietary LWF format. Offers several types of compression, lossy and lossless, some of the wavelet-based. Java 1.1.7 or higher required. Trial version and applets available.
    Netbrand Flexible Imaging System (FITS) Commercial Supports GIF, JPEG, PNG, BMP, TIFF, FlashPix (I.I.P.), and WinFax. Makes use of platform-specific hardware enhancements. Evaluation sample applets and beans are available.
    PCX Reader Freeware Read PCX files. Source code available with either English or German comments.
    PGM and PPM in Java Unknown Read and write PGM and PPM images, the page is in French, but the code has method names in English.
    PictDraw Public Domain Read Macintosh PICT files (pixel and vector graphics parts are both supported)
    PixTools Commercial, demo available Supports TIFF (including G3 and G4), BMP, JBIG (for bilevel images), GIF and JPEG. It is not clear whether all formats will be read and written.
    PNGEncoder LGPL Write PNG files (with up to 8 bits per channel). Support for an alpha channel is implemented.
    PngEncoder 1.2 LGPL Save an Image object as PNG (Portable Network Graphics) file.
    RasterMaster Commercial Read and write numerous image file formats, including TIFF, DICOM, MO:DCA, PCL, JBIG, JPEG and BMP. Also provides various image editing and processing operations.
    RGBImage ? Read RLE-compressed SGI RGB image files. Part of the City Scanning Project.
    Sanselan Java Image Library Apache Read PNG, GIF, TIFF (LZW, CCITT/Huffman, Packbits), BMP, PSD, PBM/PGM/PPM/PNM.
    Sixlegs PNG library LGPL Read and write PNG (Portable Network Graphics) files.
    Sun's com.sun.image.codec.jpeg package Unknown to me (maybe same as Java). Read and write JPEG files; classes included in Sun's JDK/JRE 1.2+, but not standard library classes, so you cannot rely on them being there with every Java VM! Documentation can be downloaded from Sun's website.
    Tiffy Commercial, trial version available Read TIFF, BMP, GIF, JPG and PNG. Various TIFF compression types are supported, decoding is relatively fast. Also includes printing, viewing and image processing functionality. Available as application (or applet) or toolkit.
    ViewTIFF Commercial, demo version available A TIFF decoder for compression methods Group 4, Group 3 (1-D and 2-D), TIFF Mode 2 and LZW.
    WBMP article ? Dynamic generation of WBMP graphs from XML data using JavaBeans and JSP. Includes sample code to write WBMP files.
    WBMPCreator Commercial Library to write various wireless image file formats: (animated) WBMP, OTB, NLM.
    WBMPMaster Free for evaluation, nothing about licensing the code. Write WBMP files. Also provides implementations of several algorithms for reducing images to black and white, plus a couple of image editing features (scaling, flipping, mirroring).
    XPM color image utility class GPL Read XPM files.

    posted @ 2006-05-23 16:08 david.turing 阅读(2234) | 评论 (0)编辑 收藏

    读取操作PDF的Java类库

    Library / package License Description
    Adobe Acrobat Reader for Java Freeware Read and display PDF documents. A viewer application and a JavaBean are available. Works with Java 1.1.8+.
    Big Faceless PDF library Commercial Write PDF documents, with support for various advanced features.
    ceTe Software Commercial DynamicPDF Generator to write, DynamicPDF Merger to read and write PDF files.
    Etymon PJ GPL / Commercial Read and write PDF documents. There are two versions, classic and professional. Classic comes under the GPL and requires Java 1.1. Professional is commercial and requires Java 1.4.
    FOP Apache License Write PDF documents, render them from XML/XSL sources.
    gnujpdf GPL Write PDF documents. An extension of the retepPDF project.
    iText LGPL Write PDF documents. Requires Java 1.2.
    PDFGo Commercial Read PDF documents. Viewer (standalone application) and Java Bean available.
    jPDFPrint Commercial (trial version available) Library to read and print PDF documents.
    jPDFProcess Commercial (trial version available) Library to read, manipulate and save PDF documents. Manipulation operations include splitting, drawing, printing, encrypting and exporting as images.
    jPDFViewer Commercial (trial version available) Java Bean to display PDF documents.
    jPDFWriter Commercial (trial version available) Pure Java library to write PDF files. Library can be used like a Java printer job. Thus, existing Java code for printing can be reused to create PDF files.
    JPedal GPL or site license or fixed fee Read PDF documents. This library can both extract content from PDFs and rasterize them.
    jPDF Commercial (trial version available on request) Manipulation of PDF files, especially suited for the server side. Features include PDF generation from templates, splitting, merging, parsing and encryption. Written in pure Java (requires Java 1.3 or higher).
    JustFormsPDF Commercial (trial version available) Pure Java library for filling and editing PDF documents with forms. Requires Java 1.2+.
    Multivalent Special license Reads PDF and other document formats. Includes a browser to view all supported files. Provides various tools to manipulate PDF files: compress, uncompress, split, merge, encrypt, decrypt, info, validate, extract text, and full-text search (with Lucene). Source code available.
    PDF stream writer Freeware Java library to convert XML to PDF files.
    PDFBox BSD Library to access PDF files. A utility to convert to text is included.
    PDFlib Commercial Read and write PDF documents. This is a C library which has Java JNI bindings.
    PDFTextStream Commercial Read PDF documents. This library can extract text and metadata from PDF files. It supports PDF up to version 1.5 and comes with support for Lucene.
    retepPDF GPL Write PDF documents.
    Saffron Document Server Commercial Reads PostScript (.ps) documents and generates PDF, HTML, RTF, TIFF, and other formats. Configured as a server for concurrent document rendering.
    SmartJPrint GPL-like Pure Java library to write PDF files. Generates PDF files from Swing GUI components, provides preview functionality.
    Snowbound Commercial Read and write PDF files.
    XMLMill Commercial, trial version available Create PDF documents from XML/XSL.

     

    posted @ 2006-05-23 14:40 david.turing 阅读(2660) | 评论 (0)编辑 收藏

    中华人民共和国电子签名法(全文)

    中华人民共和国电子签名法(全文)
    (2004年8月28日第十届全国人民代表大会常务委员会第十一次会议通过)


    目录
    第一章 总则
    第二章 数据电文
    第三章 电子签名与认证
    第四章 法律责任
    第五章 附则

    第一章 总则

    第一条 为了规范电子签名行为,确立电子签名的法律效力,维护有关各方的合法权益,制定本法。
    第二条 本法所称电子签名,是指数据电文中以电子形式所含、所附用于识别签名人身份并表明签名人认可其中内容的数据。
    本法所称数据电文,是指以电子、光学、磁或者类似手段生成、发送、接收或者储存的信息。
    第三条 民事活动中的合同或者其他文件、单证等文书,当事人可以约定使用或者不使用电子签名、数据电文。
    当事人约定使用电子签名、数据电文的文书,不得仅因为其采用电子签名、数据电文的形式而否定其法律效力。
    前款规定不适用下列文书:
    (一)涉及婚姻、收养、继承等人身关系的;
    (二)涉及土地、房屋等不动产权益转让的;
    (三)涉及停止供水、供热、供气、供电等公用事业服务的;
    (四)法律、行政法规规定的不适用电子文书的其他情形。

    第二章 数据电文


    第四条 能够有形地表现所载内容,并可以随时调取查用的数据电文,视为符合法律、法规要求的书面形式。
    第五条 符合下列条件的数据电文,视为满足法律、法规规定的原件形式要求:
    (一)能够有效地表现所载内容并可供随时调取查用;
    (二)能够可靠地保证自最终形成时起,内容保持完整、未被更改。但是,在数据电文上增加背书以及数据交换、储存和显示过程中发生的形式变化不影响数据电文的完整性。
    第六条 符合下列条件的数据电文,视为满足法律、法规规定的文件保存要求:
    (一)能够有效地表现所载内容并可供随时调取查用;
    (二)数据电文的格式与其生成、发送或者接收时的格式相同,或者格式不相同但是能够准确表现原来生成、发送或者接收的内容;
    (三)能够识别数据电文的发件人、收件人以及发送、接收的时间。
    第七条 数据电文不得仅因为其是以电子、光学、磁或者类似手段生成、发送、接收或者储存的而被拒绝作为证据使用。
    第八条 审查数据电文作为证据的真实性,应当考虑以下因素:
    (一)生成、储存或者传递数据电文方法的可靠性;
    (二)保持内容完整性方法的可靠性;
    (三)用以鉴别发件人方法的可靠性;
    (四)其他相关因素。
    第九条 数据电文有下列情形之一的,视为发件人发送:
    (一)经发件人授权发送的;
    (二)发件人的信息系统自动发送的;
    (三)收件人按照发件人认可的方法对数据电文进行验证后结果相符的。
    当事人对前款规定的事项另有约定的,从其约定。
    第十条 法律、行政法规规定或者当事人约定数据电文需要确认收讫的,应当确认收讫。发件人收到收件人的收讫确认时,数据电文视为已经收到。
    第十一条 数据电文进入发件人控制之外的某个信息系统的时间,视为该数据电文的发送时间。
    收件人指定特定系统接收数据电文的,数据电文进入该特定系统的时间,视为该数据电文的接收时间;未指定特定系统的,数据电文进入收件人的任何系统的首次时间,视为该数据电文的接收时间。
    当事人对数据电文的发送时间、接收时间另有约定的,从其约定。
    第十二条 发件人的主营业地为数据电文的发送地点,收件人的主营业地为数据电文的接收地点。没有主营业地的,其经常居住地为发送或者接收地点。
    当事人对数据电文的发送地点、接收地点另有约定的,从其约定。

    第三章 电子签名与认证

    第十三条 电子签名同时符合下列条件的,视为可靠的电子签名:
    (一)电子签名制作数据用于电子签名时,属于电子签名人专有;
    (二)签署时电子签名制作数据仅由电子签名人控制;
    (三)签署后对电子签名的任何改动能够被发现;
    (四)签署后对数据电文内容和形式的任何改动能够被发现。
    当事人也可以选择使用符合其约定的可靠条件的电子签名。
    第十四条 可靠的电子签名与手写签名或者盖章具有同等的法律效力。
    第十五条 电子签名人应当妥善保管电子签名制作数据。电子签名人知悉电子签名制作数据已经失密或者可能已经失密时,应当及时告知有关各方,并终止使用该电子签名制作数据。
    第十六条 电子签名需要第三方认证的,由依法设立的电子认证服务提供者提供认证服务。
    第十七条 提供电子认证服务,应当具备下列条件:
    (一)具有与提供电子认证服务相适应的专业技术人员和管理人员;
    (二)具有与提供电子认证服务相适应的资金和经营场所;
    (三)具有符合国家安全标准的技术和设备;
    (四)具有国家密码管理机构同意使用密码的证明文件;
    (五)法律、行政法规规定的其他条件。
    第十八条 从事电子认证服务,应当向国务院信息产业主管部门提出申请,并提交符合本法第十七条规定条件的相关材料。国务院信息产业主管部门接到申请后经依法审查,征求国务院商务主管部门等有关部门的意见后,自接到申请之日起四十五日内作出许可或者不予许可的决定。予以许可的,颁发电子认证许可证书;不予许可的,应当书面通知申请人并告知理由。
    申请人应当持电子认证许可证书依法向工商行政管理部门办理企业登记手续。
    取得认证资格的电子认证服务提供者,应当按照国务院信息产业主管部门的规定在互联网上公布其名称、许可证号等信息。
    第十九条 电子认证服务提供者应当制定、公布符合国家有关规定的电子认证业务规则,并向国务院信息产业主管部门备案。
    电子认证业务规则应当包括责任范围、作业操作规范、信息安全保障措施等事项。
    第二十条 电子签名人向电子认证服务提供者申请电子签名认证证书,应当提供真实、完整和准确的信息。
    电子认证服务提供者收到电子签名认证证书申请后,应当对申请人的身份进行查验,并对有关材料进行审查。
    第二十一条 电子认证服务提供者签发的电子签名认证证书应当准确无误,并应当载明下列内容:
    (一)电子认证服务提供者名称;
    (二)证书持有人名称;
    (三)证书序列号;
    (四)证书有效期;
    (五)证书持有人的电子签名验证数据;
    (六)电子认证服务提供者的电子签名;
    (七)国务院信息产业主管部门规定的其他内容。
    第二十二条 电子认证服务提供者应当保证电子签名认证证书内容在有效期内完整、准确,并保证电子签名依赖方能够证实或者了解电子签名认证证书所载内容及其他有关事项。
    第二十三条 电子认证服务提供者拟暂停或者终止电子认证服务的,应当在暂停或者终止服务九十日前, 就业务承接及其他有关事项通知有关各方。
    电子认证服务提供者拟暂停或者终止电子认证服务的,应当在暂停或者终止服务六十日前向国务院信息产业主管部门报告,并与其他电子认证服务提供者就业务承接进行协商,作出妥善安排。
    电子认证服务提供者未能就业务承接事项与其他电子认证服务提供者达成协议的,应当申请国务院信息产业主管部门安排其他电子认证服务提供者承接其业务。
    电子认证服务提供者被依法吊销电子认证许可证书的,其业务承接事项的处理按照国务院信息产业主管部门的规定执行。
    第二十四条 电子认证服务提供者应当妥善保存与认证相关的信息,信息保存期限至少为电子签名认证证书失效后五年。
    第二十五条 国务院信息产业主管部门依照本法制定电子认证服务业的具体管理办法,对电子认证服务提供者依法实施监督管理。
    第二十六条 经国务院信息产业主管部门根据有关协议或者对等原则核准后,中华人民共和国境外的电子认证服务提供者在境外签发的电子签名认证证书与依照本法设立的电子认证服务提供者签发的电子签名认证证书具有同等的法律效力。

    第四章 法律责任

    第二十七条 电子签名人知悉电子签名制作数据已经失密或者可能已经失密未及时告知有关各方、并终止使用电子签名制作数据,未向电子认证服务提供者提供真实、完整和准确的信息,或者有其他过错,给电子签名依赖方、电子认证服务提供者造成损失的,承担赔偿责任。
    第二十八条 电子签名人或者电子签名依赖方因依据电子认证服务提供者提供的电子签名认证服务从事民事活动遭受损失,电子认证服务提供者不能证明自己无过错的,承担赔偿责任。
    第二十九条 未经许可提供电子认证服务的,由国务院信息产业主管部门责令停止违法行为;有违法所得的,没收违法所得;违法所得三十万元以上的,处违法所得一倍以上三倍以下的罚款;没有违法所得或者违法所得不足三十万元的,处十万元以上三十万元以下的罚款。
    第三十条 电子认证服务提供者暂停或者终止电子认证服务,未在暂停或者终止服务六十日前向国务院信息产业主管部门报告的,由国务院信息产业主管部门对其直接负责的主管人员处一万元以上五万元以下的罚款。
    第三十一条 电子认证服务提供者不遵守认证业务规则、未妥善保存与认证相关的信息,或者有其他违法行为的,由国务院信息产业主管部门责令限期改正;逾期未改正的,吊销电子认证许可证书,其直接负责的主管人员和其他直接责任人员十年内不得从事电子认证服务。吊销电子认证许可证书的,应当予以公告并通知工商行政管理部门。
    第三十二条 伪造、冒用、盗用他人的电子签名,构成犯罪的,依法追究刑事责任;给他人造成损失的,依法承担民事责任。
    第三十三条 依照本法负责电子认证服务业监督管理工作的部门的工作人员,不依法履行行政许可、监督管理职责的,依法给予行政处分;构成犯罪的,依法追究刑事责任。
    第五章 附则

    第三十四条 本法中下列用语的含义:
    (一)电子签名人,是指持有电子签名制作数据并以本人身份或者以其所代表的人的名义实施电子签名的人;
    (二)电子签名依赖方,是指基于对电子签名认证证书或者电子签名的信赖从事有关活动的人;
    (三)电子签名认证证书,是指可证实电子签名人与电子签名制作数据有联系的数据电文或者其他电子记录;
    (四)电子签名制作数据,是指在电子签名过程中使用的,将电子签名与电子签名人可靠地联系起来的字符、编码等数据;
    (五)电子签名验证数据,是指用于验证电子签名的数据,包括代码、口令、算法或者公钥等。
    第三十五条 国务院或者国务院规定的部门可以依据本法制定政务活动和其他社会活动中使用电子签名、数据电文的具体办法。
    第三十六条 本法自2005年4月1日起施行。

    posted @ 2006-05-22 22:07 david.turing 阅读(1040) | 评论 (0)编辑 收藏

    中华人民共和国电子签章条例(草案)

    中华人民共和国电子签章条例 (草案)


        《电子签章条例》首先确立了电子文件和电子签章的法律效力,为文件和重要信息的网络传输提供了法律的依据。包括若干在赋予电子文件和电子签章以法律效力的过程中,保证信息安全的制度内容,包括对CA的管理,电子签章活动中的责任等等。

    第一章 总则

    第一条 为了确立电子签章和数据电文的效力,规范电子签章活动,推动国民经济和社会信息化,制定本条例。
    第二条 本条例适用 于当事人选择使用数据电子和电子签章的事项。
    国家行政机关使用电子签章,适用于本条例。
    国家行政机关在行政管理活动中使用电子签章,应征得行政相对人同意。法律另有规定的除外。
    第三条 国务院电子签章主管机关为电子签章的管理部门。

    第二章 数据电文与电子签章的效力

    第四条 经当事人同意,具备下列条件的数据电文具有与书面形式同等的效力:
    (1) 有形表现所载内容;
    (2) 随时可供打印、复制、传输或其他方式调取查阅。
    第五条 如果当事人同意,任何机构或个人不得否认电子签章的效力。法律另有规定的除外。
    第六条 满足下列条件的电子签章是安全电子签章,具有与其他形式的签名、签字或盖章同样的效力:
    (1) 可以确认使用人身份;
    (2) 能够证实该电子签章由使用人独有;
    (3) 签署后的电子签章和数据电文不可篡改,否则可被察觉;
    第七条 经安全电子签章签署的数据电文具有与原件同等的效力。
    第八条 经安全电子签章签署的数据电文属安全电子签章使用人所有。

    第三章 数字签章

    第九条 满足下列条件的数字签章是安全数字签章,具有本条例规定的安全电子签章的效力。
    (1) 密钥对由主管部门认可的认证机构生成;
    (2) 数字签章由数字证书中载明的使用人持有的私钥制作;
    (3) 包含公钥的数字证书在其有效期内,并且没有被中止或撤销;
    (4) 数字证书在认证机构规定的范围及权限内使用。
    第十条 数字证书可以由制作证书的认证机构发放,也可以由独立的发证机构发放。发放数字证书应当满足以下条件:
    (1) 向证书申请人充分说明证书的使用须知事项:
    (2) 严格遵守认证机构认证服务声明中载明的数字证书发放程序和操作规程:
    (3) 保证数字证书载明的使用人持有与数字证书中载明的公钥对应的私钥;
    (4) 对数字证书中载明的所有信息进行核实,否则,必须明确说明未经核实的信息;
    (5) 确信应当披露的重大信息均已披露。
    第十一条 证书发放后,负责发放证书的认证机构或发证机构应当立即在相关证书库中公告证书。
    第十二条 下列情况下,认证机构应当撤消已经发放的数字证书,并在相关证书库中公告。
    (1) 数字证书持有人为自然人时,该人死亡的;
    (2) 数字证书持有人为法人时,该法人已经解体或撤销的;
    (3) 数字证书持有人申请撤销的;
    (4) 认证机构或发证机构认为数字证书中存在虚假信息披露的;
    (5) 认证机构认为系统存在技术问题,影响到认证可靠性的。
    依据(3)、(4)、(5)款撤销数字证书后,认证机构应立即通知数字证书持有人。
    第十三条 数字证书持有人或数字证书的发证机构可向认证机构申请中止数字证书。
    认证机构在收到持有人的中止申请后,应当立即中止数字证书。
    认证机构在收到发证机构的中止申请后,应当立即中止数字证书并通知数字证书持有人。
    被中止的数字证书应当在相关证书库中公告。
    第十四条 数字证书发证机构与认证机构不同时,发证机构与认证机构之间的法律关系应当通过协议明确。认证机构应当将此类协议公告。
    第十五条 认证机构的设立与终止必须遵守国家的有关规定。
    第十六条 认证机构应当使用安全可靠的系统提供在服务。
    本处安全可靠的系统是指符合以下所有条件的计算机系统:
    (1) 符合规定的安全等级保护标准;
    (2) 在合理的期限和范围内适用于指定的功能;
    (3) 能够确保可用性、可靠性和正确性被广泛接受。
    第十七条 认证机构和发证机构应当妥善保存与认证直接相关的信息。信息保存期至少为证书失效后两年。
    当事人另有要求或当事人与认证机构或发证机构之间另有约定的,从其约定。法律另有规定的,从其约定。

    第四章 使用人

    第十八条 使用人享有依本条例获得的安全电子签章的专有使用权。
    第十九条 使用人有权选择电子签章。
    第二十条 使用人应当妥善保管自己的电子签章或用于制作数字签章的私钥,防止向未经授权的他人泄露。发现泄露应及时通知认证机构撤销或中止相应的数字证书。
    第二十一条 使用人选择安全电子签章时,应当遵守管理部门制定的技术标准和使用规范。
    第二十二条 使用人以申请安全电子签章为目的提交的信息应当真实准确。

    第五章 法律责任

    第二十三条 未经授权冒用他人名义使用电子签章,损害他人权利的,应当承担相应的民事责任。构成犯罪的,应当承担刑事责任。
    第二十四条 使用人未尽到第二十条规定的妥善保管义务,造成损失的,由使用人负责。
    第二十五条 使用人选择未经电子签章管理部门认可的电子签章技术,或使用人选择未经电子签章管理部门认可的认证机构提供的服务,由相关各方通过协议明确责任。
    第二十六条 电子签章使用人故意提供虚假信息,造成其他利益相关人经济损失的,应承担赔偿责任。构成犯罪的,应承担刑事责任。
    第二十七条 认证机构没有及时中止或撤销数字证书,造成其他利益相关人经济损失的,应承担赔偿责任。
    第二十八条 发证机构或认证机构未满足第十一条规定的证书发放条件,造成数字证书持有人或其他利益相关人经济损失的,应承担赔偿责任。发证机构与认证机构另有约定的,从其约定。
    第二十九条 认证机构没有履行认证服务声明中载明的义务,或没有严格按照认证服务声明公告的程序、标准或规范操作,造成使用人或其他利益相关人损失的,应承担赔偿责任。
    第三十条 因系统运行故障,造成使用人或其他利益相关人员损失的,认证机构应承担赔偿责任。但以下情况除外:
    (1) 因不可抗力造成系统故障的;
    (2) 因不可预见原因造成系统故障的。
    认证机构与使用人另有约定的,从其约定。

    第六章 附则

    第三十一条 根据需要,电子签章管理部门可以就安全电子签章的种类、技术标准及使用规范制定管理办法。
    第三十二条 在电子签章过程中使用密码时,必须遵守国家管理的有关规定。
    第三十三条 本条例中,数据电子是指由电子手段、光学手段或类似手段生成、储存或传输的信息,包括电报、电传、传真、电子数据交换、电子邮件及其他形式。
    电子签章是指为确定使用人身份,在数据电文中所含、所附或在逻辑上与之相关联的数据。
    使用人是指合法获得和使用电子签章的自然人、法人或其他组织。
    数字签章是采用非对称密码系统的电子签章。非对称密码系统能够生成安全配对的密钥,私钥用于制作签章、公钥用于验证签章。
    数字证书是指为证实数字签章使用人身份、由认证机构制作的数据电文,数字证书中应当包括以下信息:
    (1) 制作数字证书的认证机构;
    (2) 公钥;
    (3) 与数字证书中载明的公钥配对的私钥持有人的身份或其他主要特征;
    (4) 使用数字证书的有效期、权限及范围;
    (5) 电子签章管理部门规定的其他信息。
    证书库是指用作储存及检索数字证书及其他与数字证书有关信息的信息系统。
    认证服务声明是指,认证机构制定并公告、包括认证服务程序、认证服务标准及认证服务操作规程等内容的文件。
    认证机构是指制作数字证书并提供认证服务的法人或其他组织。
    发证机构是指发放数字证书的法人或其他组织。
    中止是指暂时地停止。
    撤销是指永久地终止。
    第三十四条 本条例由国务院解释。
    第三十五条 本条例自2003年6月1日起生效。

    posted @ 2006-05-22 22:06 david.turing 阅读(1046) | 评论 (0)编辑 收藏

    电子认证服务机构有关标准规范(ecsa.gov.cn)

    电子认证服务机构有关标准规范(参考)

     

    一、认证系统主要技术标准

    密码算法和标准:

    加密:

    SSF33 密码算法

    数字签名:

    RSA 数字签名,符合 PKCS#1 V2.0

    散列函数:

    SHA 1 ,符合美国 FIPS PUB 180 1 ANSI X9.30 ( 第二部分 )

    密钥管理:

    RSA 密钥传输,符合因特网 RFC 1421 1423 (PEM) PKCS#1 V2.0

    数据格式和协议:

    RSA 算法标识符和公开密钥格式,符合 PEM PKCS #1 V2.0

    证书和证书注销表格式:

    3 版证书和证书扩展,符合 ITU Trec.X.509 (1997) 和公用标准 ISO/IEC 9594-8 (1997)

    证书注销表和证书注销表扩展,符合 IETF PKIX 1 概况表技术规范

    文件包封格式:

    基于因特网 RFC 1421 (PEM) 的标准文件包封格式

    安全文件包封技术,符合 PKCS#7 S/MIME

    安全会话格式:

    使用简单公钥机制 (SPKM) ,符合因特网 RFC 2025 SPKM 实体验证,符合 FIPS 196

    目录协议:

    轻量目录存取协议 (LDAP) ,符合 RFC 1777

    PKI 操作协议:

    符合 PKIX 2

     

     

    二、认证系统密码及其相关安全技术规范

    《证书认证系统密码及其相关安全技术规范(试行)》国家密码管理委员会办公室

    三、物理环境建设标准

    (一)建设参照标准规范

    GB 50174-93 《电子计算机机房设计规范》

    GB 2887-89 《计算站场地技术条件》

    GB 9361-88 《计算站场地安全要求》

    GB 6650-1986 《计算机机房用活动地板技术条件》

    GB 50034-1992 《工业企业照明设计标准》

    GB 5054-95 《低压配电装置及线路设计规范》

    GBJ 19-87 《采暖通风与空气调节设计规范》

    GB 157 《建筑防雷设计规范》

    GBJ 79-85 《工业企业通信接地设计规范》

    (二)可验收标准规范

    GBJ 232-83 《电气装置安装工程及验收规范》

    GB 50045-95 《高层民用建筑设计防火规范》

    GBJ 16-87 《建筑设计防火规范》

    GB 50222-95 《建筑内部装修设计防火规范》

    GBJ 116-88 《火灾自动报警系统设计规范》

    GB 50263-97 《气体灭火系统施工及验收规范》

    (三)可检测标准规范

    GB 8702-88 《电磁辐射防护规则》

    GB-12190 《高性能屏蔽室屏蔽效能的测量方法》

    GJBZ 20219-94 《军用电磁屏蔽室通用技术要求和检测方法》C级标准

    BMB 3-1999 《处理保密信息的电磁屏蔽室的技术要求和测试方法》

    四、认证系统安全认证标准(参考,暂不作为要求))

    GB/T 18336 2001 《信息技术 安全技术 信息技术安全性评估准则》

    ISO/IEC 17799 2000 《信息技术 信息安全管理实施细则》

    posted @ 2006-05-22 21:56 david.turing 阅读(1313) | 评论 (0)编辑 收藏

    Java KeyStore的类型

         摘要: 总结各种Java KeyStoreType  阅读全文

    posted @ 2006-05-22 01:57 david.turing 阅读(3182) | 评论 (1)编辑 收藏

    计算HMAC

    Message Authentication Code (MAC) 是用于确信信息在传输过程中没有被修改过,体现了信息完整性, MAC 有很多种算法,大部分算法用于简单的场景(如文件传输),他们都有效,但如果用于都未曾考虑会被恶意攻击的情况,在密码学领域中,更多被应用的是 HMAC HMAC 更安全,因为它是基于 Key 的。 HMAC 是使用诸如 MD5,SHA-1 等散列算法构造 MAC

    HMAC 在这样一种场景中被应用:

    巴赫尔、穆罕默德是为伊拉克临时政府中不同的伊斯兰派系,由于美国已经在伊拉克设置了大量情报机构,他们担心政府部内部文件在网络传输可能被美国情报局修改,考虑起见,巴赫尔、穆罕默德决定使用 MAC 技术:

    1,  他们商榷一个简单的密钥 Key1

    2,  他们商榷一种可靠的 HMAC 算法,如 HMACSHA1

    3,  他们每次发送政府审批报告前,都用 HMACSHA1 进行计算,并将该 hmac x1 附带发送给对方

    4,  对方接收到文件,将文件进行一次 HMAC 的计算,得出新的 hmac x2 ,对比 x1 x2 ,可以知道文件是否在中途被修改过。

    注意,上述的步骤如果不考虑恶意攻击者,可以使用消息摘要,恶意攻击者可以修改你的文件,然后重新帮你计算摘要,最后替换你的摘要:(

           关于 HMAC 的更多标准,可以参考 RFC2104

    package  org.dev2dev.security.test.mac;

    import  java.io.File;
    import  java.io.IOException;
    import  java.security.InvalidKeyException;
    import  java.security.NoSuchAlgorithmException;

    import  javax.crypto.KeyGenerator;
    import  javax.crypto.Mac;
    import  javax.crypto.SecretKey;

    import  org.dev2dev.common.FileUtils;

    public   class  TestHmac {

     
    /**
      * 
    @param  args
      
    */

     
    public   static   void  main(String[] args)  {
         
    try   {
             
    // 首先需要生成Hmac的key,有比较多种方法,HmacSHA1,算法类型可以参考KeyGenerator算法列表 
                  // 本例子用KeyGenerator生成key,实际上,key可以保存起来,也可以被分发给其他人
             KeyGenerator keyGen = KeyGenerator.getInstance("HmacMD5"); 
             SecretKey key = keyGen.generateKey();
             Mac mac 
    = Mac.getInstance(key.getAlgorithm());
             mac.init(key);
                 
             File infile
    =new File("c:\\1.txt");
             
    byte[] inputbyte=null;
       
    try {
        inputbyte 
    = FileUtils.getBytesFromFile(infile);
       }
     catch (IOException e) {
        e.printStackTrace();
       }

             
    byte[] digest = mac.doFinal(inputbyte);
         
             
    // If desired, convert the digest into a string
             String HmacB64 = new sun.misc.BASE64Encoder().encode(digest);
             System.out.println(
    "计算的HMAC ="+ HmacB64);
         }
      catch  (InvalidKeyException e)  {
          e.printStackTrace();
         }
      catch  (NoSuchAlgorithmException e)  {
          e.printStackTrace();
         }
     

     }


    }

    posted @ 2006-05-21 17:05 david.turing 阅读(867) | 评论 (1)编辑 收藏

    Sourceforge最近一段时间排名前50的Project

    这是过去一周,SF排名前50的Projects!

    Rank     Project Name      Percentile
      
    1      ZK  -  Ajax but no JavaScript      100.000
      
    2      Gaim      99.999
      
    3      FCKeditor      99.999
      
    4      XOOPS Dynamic Web CMSAccepting Donations      99.998
      
    5      OpenWFEAccepting Donations      99.997
      
    6       7 - Zip      99.997
      
    7      phpMyAdminAccepting Donations      99.996
      
    8      aMSN      99.996
      
    9      FileZillaAccepting Donations      99.995
      
    10      KoLmafiaAccepting Donations      99.994
      
    11      StellariumAccepting Donations      99.994
      
    12      MiKTeXAccepting Donations      99.993
      
    13      Compiere ERP  +  CRM Business SolutionAccepting Donations      99.992
      
    14      InkscapeAccepting Donations      99.992
      
    15      KeePass Password SafeAccepting Donations      99.991
      
    16      XUIAccepting Donations      99.991
      
    17      Gallery      99.990
      
    18      TV - Browser  -  A free EPGAccepting Donations      99.989
      
    19      AzureusAccepting Donations      99.989
      
    20      PHP For Applications  -  PHP FrameworkAccepting Donations      99.988
      
    21      RSSOwl  |  RSS  /  RDF  /  Atom NewsreaderAccepting Donations      99.987
      
    22      JasperReports      99.987
      
    23      ndiswrapperAccepting Donations      99.986
      
    24      PhpGedViewAccepting Donations      99.986
      
    25      PDFCreatorAccepting Donations      99.985
      
    26      Asterisk@HomeAccepting Donations      99.984
      
    27      Extended BitTorrent Client and TrackerAccepting Donations      99.984
      
    28      Wicket      99.983
      
    29      WebCalendarAccepting Donations      99.982
      
    30      MediaCoderAccepting Donations      99.982
      
    31      IT ++       99.981
      
    32      Coppermine Photo Gallery      99.981
      
    33      soapUI      99.980
      
    34      guliverkli      99.979
      
    35      Ares Galaxy      99.979
      
    36      Owl Intranet KnowledgebaseAccepting Donations      99.978
      
    37      freePBXAccepting Donations      99.977
      
    38      BitPim      99.977
      
    39      UFO:Alien Invasion NG      99.976
      
    40      Password SafeAccepting Donations      99.976
      
    41      Cellocity Linux For Cell Processors / PS3sAccepting Donations      99.975
      
    42      MinGW  -  Minimalist GNU  for  Windows      99.974
      
    43      Notepad ++ Accepting Donations      99.974
      
    44      PCGen :: An RPG Character GeneratorAccepting Donations      99.973
      
    45      Firebird      99.972
      
    46      Enterprise CRM and Groupware SystemAccepting Donations      99.972
      
    47      ClamWin Free AntivirusAccepting Donations      99.971
      
    48      G3D  -  3D EngineAccepting Donations      99.971
      
    49      eXistAccepting Donations      99.970
      
    50      Sahi  -  Web Automation and Test Tool      99.969

    posted @ 2006-05-18 21:56 david.turing 阅读(1927) | 评论 (5)编辑 收藏

    关于支持Stroll拖动的SWT Table的设计方法

    蛋蛋同志问起:

    ( 2006 - 05 - 18   13 : 49 : 48 )   邢红瑞( 50128986 )
    david师傅,SWT中Table如何出现横向滚动条


    其实方法很简单,就是用一个scrolledComposite包住这个Table,呵呵

      protected   void  createContents()  {
      setText(
    " SWT Application " );
      setSize(
    500 375 );

      
    final  ScrolledComposite scrolledComposite  =   new  ScrolledComposite( this , SWT.BORDER  |  SWT.H_SCROLL  |  SWT.V_SCROLL);
      
    final  Composite composite  =   new  Composite(scrolledComposite, SWT.NONE);
      table 
    =   new  Table(composite, SWT.BORDER);
    .


    效果如下图:

    swttable.gif

    posted @ 2006-05-18 14:25 david.turing 阅读(2097) | 评论 (0)编辑 收藏

    绿色Putty的做法——将putty session保存到一个reg文件中

    cyt最近要搞绿色工具箱,本人友情赞助了一个WinOrganizer破解绿色版本,另外,cyt还需要一个putty附带session的功能,但putty的session都是保存到注册表,如果绿色化,只能靠一些额外的手段。

    putty主站介绍一种办法,就是把sesssion记录导入到注册表中去,一个bat文件就行了,当然,绿色在外,不太希望在客户的主机上留下痕迹,所以,用完putty,bat还需要把客户的注册表中的session信息!
    下面的putty.bat来自于sgtatham的blog:

    @ECHO OFF
    regedit 
    / s putty.reg
    regedit 
    / s puttyrnd.reg
    start 
    / w putty.exe
    regedit 
    / e puttynew.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
    copy puttynew.reg putty.reg
    del puttynew.reg
    regedit 
    / s puttydel.reg


    该批处理文件需要两个额外的文件
    PUTTYRND.REG 用于设置which sets upPUTTY.RND种子文件的初始位置(安全考虑)
    PUTTYDEL.REG 销毁主机上的session记录的痕迹,并保存到现有的文件中去。.

    PUTTYDEL.REG:

    				
    REGEDIT4

    [ -HKEY_CURRENT_USER\Software\SimonTatham\PuTTY ]

    PUTTYRND.REG file:

    				
    REGEDIT4
     
    [ HKEY_CURRENT_USER\Software\SimonTatham\PuTTY ]
      "RandSeedFile"="u:\putty.rnd"

    putty.rnd是种子文件,放在绿色工具箱中(如u盘)即可。

    posted @ 2006-05-18 13:38 david.turing 阅读(1669) | 评论 (1)编辑 收藏

    请gmail用户警惕gmail.cn

    向所有Gmail用户告诫,切勿用gmail帐号登陆gmail.cn!!
    该网站可能会记录下你的gmail密码!!
    gmail.cn属于非法抢注域名,我本人对此事感到遗憾。
    下面是gmail.cn的域名信息:

    Domain Name: gmail.cn
    ROID: 20030801s10001s00869606-cn
    Domain Status: ok
    Registrant Organization: 爱思美北京信息科技有限公司
    Registrant Name: 爱思美
    Administrative Email: yanjie@ism.net.cn
    Sponsoring Registrar: 厦门华商盛世网络有限公司
    Name Server:ns.ism.net.cn
    Name Server:ns2.ism.net.cn
    Registration Date: 2003-08-01 17:48
    Expiration Date: 2009-08-01 17:48

    posted @ 2006-05-17 15:05 david.turing 阅读(1055) | 评论 (0)编辑 收藏

    几个PageRank=10的网站,中国网站一个都没有

    国人一定要加油了。

    Title:
    PR
    Backlinks
    URL:
    Adobe
    10
    82,600
    Adobe Acrobat
    10
    617,000
     World Wide Web Consortium
    10
    166,000
    Macromedia
    10
    31,600
     Energy.gov
    10
    43,000
     Apple - QuickTime
    10
     31,200
     Keio University
    10
    4,020
    National Aeronautics and Space Administration
    10
    64,400
    Apple Computers
    10
    74,400
    U.S Goverment Official Portal
    10
    192,000
    Google Search
    10
    3,830,000
    W3C CSS Validation Service
    10
    322,000
    The European Research Consortium for Informatics and Mathematics
    10
    1,540
    MIT Laboratory for Computer Science
    10
    4,200
    National Science Foundation
    10
    27,100
    The New York Times
    10
    189,000
    Language Tools
    10
    10,800
    Real Media
    10
    130,000
    The Web Standards Project
    10
    12,900
    Stat Counter
    10
    1,330,000


    posted @ 2006-05-16 14:14 david.turing 阅读(1010) | 评论 (0)编辑 收藏

    Google对几个Java关键字的最低竞价

         摘要: 最近,通过 Google 做 UserGroup 广告,发现每个Java关键字的最低竞价都是不一样的,几个常用的Sun关键字在google的竞价最低费用: 关键字 ...  阅读全文

    posted @ 2006-05-14 15:14 david.turing 阅读(1641) | 评论 (2)编辑 收藏

    广州UserGroup将启用gzug.org域名

    目前,GZ UserGroup成员只需要交纳5元即可享有2级域名的权利。
    希望大家努力筹够100元。

    目前,承诺交纳费用的人员有
    david.turing
    simon.liang
    Rayman

    posted @ 2006-05-11 21:05 david.turing 阅读(837) | 评论 (8)编辑 收藏

    将邮件与PGP绑定,建立安全身份认证基础

         摘要: 加入PGP行列,享受免费身份服务  阅读全文

    posted @ 2006-05-10 22:24 david.turing 阅读(4046) | 评论 (13)编辑 收藏

    认为有必要抵制房地产商的朋友请留下芳名

    我五一节本已经下诚意金于广州某一楼盘,但受伟大的不买房联盟的号召,已经决定退订,以支持他们!

    如果你确定加入此行列,请链接下面的图标(不买房联盟的图标)到你的Blog或者网站上。
    不买房联盟.jpg

    posted @ 2006-05-09 21:36 david.turing 阅读(789) | 评论 (16)编辑 收藏

    关于[深入Java 2平台安全--体系架构、API设计和实现(第二版)]的翻译质量

    近日, 朋友告诉我<<深入Java 2平台安全--体系架构、API设计和实现(第二版)>>这本书已经出版:
    http://www.china-pub.com/computers/common/info.asp?id=14712
    英文原版的书名是
    Inside Sun™ 2 Platform Security: Architecture, API Design, and Implementation, Second Edition
    我粗看了一下,发现书评中很多对本书翻译质量的怀疑,下载了Sample章节,粗看了一下,发现未
    尽人意,确实会给读者的理解带来很大的困难。
    我觉得Security的兴趣者无需太关注中文译作,也不需质疑译者和出版商,因为翻译Security Topic的书籍
    本身是一件非常困难的事情,除非译者对Java Security的概念非常清晰,否则即使哪怕是一个概念上的误译,
    到可能会导致读者产生很离谱的误解。
    Sun Security的内容不象一些实践性的topic,如Spring,Hibernate,Ajax那样,可以通过大量的Sample来解释,
    它需要读者具备一定的Security概念基础后,才能解释清楚(即概念的理解门槛比较高)。
    所以,我还是建议,对于宫力大牛的大作,还是主张看英文版和JDK Specification,其实Sun的Java Security的
    Spesification很多都是出自宫力之手,看着些Spesification当然没有看故事书那么舒服,但认真咀嚼几次,效果
    总比看那些容易导致误解的译作要好得多。

    目前,Java Security的书基本上有两本:
    IBM专家组们编写的:
    Enterprise Sun Security: Building Secure J2EE Applications
    By Marco Pistoia, Nataraj Nagaratnam, Larry Koved, Anthony Nadalin
     
    Publisher: Addison Wesley
    Pub Date: February 20, 2004
    ISBN: 0-321-11889-8
    Pages: 608
    Slots: 1.0

    Sun专家组编写的:
    Inside Sun™ 2 Platform Security: Architecture, API Design, and Implementation, Second Edition
    By Li Gong, Gary Ellison, Mary Dageforde
     
    Publisher: Addison Wesley
    Pub Date: June 06, 2003
    ISBN: 0-201-78791-1
    Pages: 384
    Slots: 1

    这两本书,前者更关注于J2EE实践的角度出发,后者更偏重于从基础概念与Java Platform的角度出发,都是很好的书,
    很容易就能Emule到这两本书。
    我个人更偏向建议读者先细读后一本,然后再粗看前一本书的一些topic。
    两本书都基本上都没有花很大力去解析Java沙箱(SandBox),Java权限控制模型等这些比较难搞得概念,有点遗憾,希望
    自己也能尽快抽时间提供一篇深入浅出于Java Security的文章:)

    posted @ 2006-05-03 16:26 david.turing 阅读(1828) | 评论 (2)编辑 收藏

    如何从pfx/p12文件中提取RSA密钥长度及其他相关信息

         摘要: 本文介绍了如何(用BouncyCastle提供的SecurityProvider)从pfx/p12证书文件中提取信息(如算法类型,算法长度,Subject信息,Issuer信息等)  阅读全文

    posted @ 2006-04-29 09:38 david.turing 阅读(7433) | 评论 (13)编辑 收藏

    剖析CAS Proxy的设计原理

         摘要: 本文简要介绍如何CAS Proxy的原理及配置  阅读全文

    posted @ 2006-04-26 23:54 david.turing 阅读(4454) | 评论 (0)编辑 收藏

    Confluence和AD的集成认证

    在GZFB群听Rayman说,要搞Confluence跟AD的集成认证,由于没听清楚,还以为是SSO,立马打开Confluence跟LDAP集成的文档,细看了一把,发现并没有实现域用户到Confluence的SSO,只是Confluence做了一个LdapProvider,能够让用户的认证实现转移到LDAP上。
    http://confluence.atlassian.com/display/DOC/Enable+LDAP+authentication

    该文档是完整并且正确的,配置也非常简单,Rayman很快就配置好了。我后来发现他的配置方法跟上述方法不一样,他是根据以下的文档配置的:
    http://confluence.atlassian.com/display/DEV/Confluence+LDAP+Integration

    这两种配置方式由比较大的区别:如果你的Confluence跟JIRA捆绑,请使用前者,否则,建议用后者。

    最后,隆重推荐Rayman的Blog:http://raymanzhang.cnblogs.com/
    一个曾经编写了MDict的好同志

    posted @ 2006-04-24 22:42 david.turing 阅读(944) | 评论 (0)编辑 收藏

    0Day发布Confluence 2.1.4 破解,所见即所得的编辑界面终于亮相

         摘要: 0Day发布Confluence 2.0破解,适合于Confluence 2.0,Confluence 2.1.4,Confluence 2.1.5  阅读全文

    posted @ 2006-04-17 23:43 david.turing 阅读(3296) | 评论 (47)编辑 收藏

    RSS工具-Feeddemon(Feedaemon,Feeddaemon)破解2.0出炉了

    我还真的想不到有哪个工具能跟这个工具相比,界面太友好,功能太强大了。
    GreatNews等工具都卸了,Feeddemon 2.0 RC版!
    http://dev2dev.bea.com.cn/bbs/servlet/D2DServlet/download/29304-34060-200187-2809/FD2_Crack.rar

    我将我的Opml文件(包含了我收集的所有RSS),希望分享给其他朋友
    下载:http://www.blogjava.net/Files/openssl/david-rss-opml.rar
    安装完Feeddemon后,直接导入opml文件即可

    posted @ 2006-04-15 14:45 david.turing 阅读(1163) | 评论 (3)编辑 收藏

    如何提高自己的Blog在Goolge中的排名

    近日,我跟很多朋友讨论如何提高自己的Blog在Google的排名我列举一些比较重要的因素,其中,

    1,内容的专业性,这一点可能Google会对你网页做定性分析。

    2,被Rank值很高的网站指向你,如果你的Blog的Link出现在IBM.com(9)/AOL.com(9)的首页,那我估计你的Rank不会少于5.

    3,写Blog的同时要提供Blog的关键字,同时也是职业操守。

    4,加入Google广告,这个比较简单,以我自己的Blog为例(http://openss.blogjava.net),
    我在Blogjava的(cnblog.com也是一样的)
    管理->选项->Configure->公告
    管理->选项->Configure->子标题


    插入以下的Google广告的JS代码:
    <script type="text/javascript">
    <!--
    google_ad_client = "pub-6825418521341757";
    google_ad_width = 120;
    google_ad_height = 240;
    google_ad_format = "120x240_as";
    google_ad_type = "text_image";
    google_ad_channel ="6369214374";
    google_color_border = "336699";
    google_color_bg = "FFFFFF";
    google_color_link = "0000FF";
    google_color_url = "008000";
    google_color_text = "000000";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>


    过1-2个月,你就会发现Rank值提高了。欢迎各位同胞加入讨论。

    posted @ 2006-04-15 14:08 david.turing 阅读(1093) | 评论 (1)编辑 收藏

    BEA SOA广州站归来

         摘要: SOA——号称解冻2000亿美金IT冻结资产的主要手段  阅读全文

    posted @ 2006-04-06 21:16 david.turing 阅读(1395) | 评论 (4)编辑 收藏

    WeblogicServer绑定AD认证

    1,构造一个干净的域,域名为domain002
    2,构造该域里面的用户
    weblogic The default administration user DefaultAuthenticator
    user0001 weblogic DefaultAuthenticator
    user0002 user0002 DefaultAuthenticator
    3,建立一个组,weblogicAdmin,同时在AD中也建立一个这样的组
    注意,在AD中的users而不是Builtin里面建组,因为两者的DN是不一样的。
    4,将所有Weblogic中的user0001用户都加入到改组。
    5,测试AD的可连接性,下载一个LDAP Browser。
    6,在Weblogic Console中的Security->Realm的Authentication配置一个新的LDAP Provider,类型为:Configure a new Active Directory Authenticator...
    7,配置参数:
    i) 转到Active Directory那一Tab,看到HOST了吧?
    HOST为你的AD的IP或者主机名,AD默认端口是389
    ii) Principal为CN=user0001,CN=Users,DC=dlsvr,DC=com
    其中,DC=dlsvr,DC=com为我的服务器的RootDN(例如DC=ibm,DC=com)
    很讨厌AD的一个地方是它采用与其他LDAP不一样的命名方法,他用CN=User而不是OU=....,所以我前面的步骤才需要建立一个welogicAdmin的组。
    iii)Credential为AD中user0001的密码。
    注意:ii)和iii)是用于连接AD用的,构造一个LDAPConnection需要用户名密码的,懂不懂:)
    转到user tab
    iv) User Name Attribute:user0001
    v) User Base DN:CN=Users,DC=dlsvr,DC=com
    转到group tab
    vi) Group Base DN:CN=weblogicAdmin,CN=Users,DC=dlsvr,DC=com
    vii) weblogicAdmin
    保存
    关键的步骤到了:
    Security->Realms->myrealm->Providers->Authentication
    有没有看到Re-order the Configured Authentication Providers
    对,就是这里需要调整一下顺序。
    把ActiveDirectoryAuthenticator调整到最上面(优先级最高)
    然后设置ActiveDirectoryAuthenticator的General页里面的Control Flag为Required。
    接着DefaultAuthenticator里面的设成是OPTIONAL。
    于是,AD取代了以前的DefaultAuthenticator了,如果两个都Requried,那么也你要接受双重认证,汗......一般不需要这样。
    注意:boot.properties里面的默认的Weblogic启动账号同样受AD影响,你如果在AD里面禁止了Weblogic这个账号,我保证你WLS启动不了

    posted @ 2006-04-02 12:05 david.turing 阅读(780) | 评论 (0)编辑 收藏

    基于NTLM的Proxy认证

         摘要:   阅读全文

    posted @ 2006-04-02 12:03 david.turing 阅读(1557) | 评论 (3)编辑 收藏

    CAS集成Weblogic的ServletAuthentication调用

    本来,使用j_security_check是最简单的Build-in认证方式,但CAS有自己的登录入口,即login servlet,如果用该servlet,必须自己动手完成JAAS的登录。于是,开始扩展CAS的edu.yale.its.tp.cas.auth.provider,在该包中的provider都扩展自authHandler接口,而CAS是在web.xml中定义了最终使用哪一个authHandler。

    edu.yale.its.tp.cas.authHandler
    edu.yale.its.tp.cas.auth.provider.WeblogicHandler

    我自己写了一个WeblogicHandler(edu.yale.its.tp.cas.auth.provider包中),专门让CAS登录到Weblogic Server,事实上,将来如果不用WLS,还可能使用Websphere,Jboss,AD之类。

    后来发现,虽然能loginContext拿到Subject,但该Subject的Principal不能被页面的request.getPrincipal()所取得,醒悟自己在做JAAS Login,查看weblogic文档,原来Weblogic提供了
    weblogic.servlet.security.ServletAuthentication
    用于在Servlet端调用JAAS接口进行登录,通过该接口登录后,就如同User使用了标准的登录机制登入了Weblogic。
    于是,立即修改了login servlet测试一下,加入

    try {
    CallbackHandler handler = new SimpleCallbackHandler(
    request.getParameter("username"),
    request.getParameter("password"));
    Subject mySubject = weblogic.security.services.Authentication
    .login(handler);
    weblogic.servlet.security.ServletAuthentication.runAs(
    mySubject, request);
    System.out.println("mySubject[" +mySubject.toString()+"]"+
    "写入Session");
    } catch (LoginException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    然后,页面果然就能拿到Pincipal了。

    posted @ 2006-04-02 12:02 david.turing 阅读(1449) | 评论 (1)编辑 收藏

    Tomcat(直至5.5.9版本)不支持KeyStore和KeyEntry使用不同的password

    今天,有朋友在配置Tomcat SSL的时候,出现如下的异常:
    java.security.UnrecoverableKeyException: Cannot recover key
    而且他已经正确配置了keystoreFile和keystorePass。
    后来我发现,他对Keystore中的Key使用了Password保护,而且
    保护这个KeyEntry的KeyPass!=KeyStore的Keypass,导致出错,
    Tomcat SSL要求这两个密码必须相等。
    解决办法:
    keytool -keypasswd -v -alias mykeyalias -keypass noequalpass -new equalpass -keystore mykeystore.jks -storepass equalpass
    其中, mykeyalias是key在keystore中的别名,-keypass后面跟key的旧密码"noequalpass", -new 是新密码"equalpass",注意新密码跟storepass一致。

    附:Weblogic是支持不一致的KeystorePass和KeyPass的。

    posted @ 2006-04-02 12:00 david.turing 阅读(620) | 评论 (0)编辑 收藏

    JVM是怎樣進行授權控制的

         摘要: 如果不是從PirvilegedAction中擴展的類,那麼調用其中的方法JVM還會不會執行權限檢查?  阅读全文

    posted @ 2006-04-02 11:53 david.turing 阅读(1114) | 评论 (0)编辑 收藏

    [转载]2005年中国软件产业最大规模前100家企业名单

         摘要: 2005年中国软件产业最大规模前100家企业名单  阅读全文

    posted @ 2006-04-02 00:41 david.turing 阅读(6637) | 评论 (3)编辑 收藏

    如何用脚本快速修改IP地址(Netsh)

    如果通过Windows的网络属性修改Ip/网关,真是太麻烦了。
    最近一个项目经常要切换ip,所以我写了两个脚本:
    c:\116.bat
    netsh interface ip set address "本地连接" static 10.45.128.116 255.255.255.0 10.45.128.254 1

    c:\172.bat
    netsh interface ip set address "本地连接" static 172.17.9.222 255.255.255.0 172.17.9.51 1

    这样就可以设置IP/Mask/GateWay了,netsh命令真方便!

    posted @ 2006-03-30 15:14 david.turing 阅读(4448) | 评论 (6)编辑 收藏

    BEA的Workshop3赢得EclipsCon的[Best Commerical Eclipse based developer tool]大奖

         摘要: BEA Workshop Studio 3.0 依靠易用性和强大功能赢得EclipseCon2006的基于EC的开发工具第一首先  阅读全文

    posted @ 2006-03-30 13:02 david.turing 阅读(1142) | 评论 (1)编辑 收藏

    Marc Fleury指出Geronimo和Behieve是IBM/BEA向开源社区输出的垃圾

         摘要: Geronimo是IBM为第三世界准备的吗?Beehive是BEA内部的次品代码?  阅读全文

    posted @ 2006-03-28 23:46 david.turing 阅读(1317) | 评论 (0)编辑 收藏

    BEA和IBM联合发布Apache Tuscany,预示Java标准走向分裂

         摘要: BEA和IBM联合发布了SDO规范,JCP似乎被忽略了,Java标准究竟由谁制定?  阅读全文

    posted @ 2006-03-28 02:05 david.turing 阅读(2433) | 评论 (4)编辑 收藏

    Weblogic download url记载

         摘要:   阅读全文

    posted @ 2006-03-20 22:02 david.turing 阅读(2930) | 评论 (9)编辑 收藏

    javax.security.auth.login.LoginException:没有为 XXX 配置LoginModules

         摘要: 回答困挠人的javax.security.auth.login.LoginException:没有为 XXX 配置LoginModules问题  阅读全文

    posted @ 2006-03-20 10:17 david.turing 阅读(3080) | 评论 (5)编辑 收藏

    [新闻]EclispeCon开始,密切关注

         摘要: 关注最新的EclipseCon上,将有哪些精彩的Topic  阅读全文

    posted @ 2006-03-19 16:57 david.turing 阅读(1334) | 评论 (1)编辑 收藏

    发布SecureX 2.0.0——KeyTool Eclipse Plugin+CryptoAPI Integrated+Java Watermark

         摘要: 发布Eclipse的Keytool Eclipse Plugin——代号SecureX
    版本1.0.0  阅读全文

    posted @ 2006-03-17 10:38 david.turing 阅读(3059) | 评论 (8)编辑 收藏

    [即学即用]正则语法的一次小应用——Emeditor

         摘要: 一个很简单Emditor/Editplus的正则表达式用法,替换一个日期  阅读全文

    posted @ 2006-03-16 17:40 david.turing 阅读(1819) | 评论 (5)编辑 收藏

    导航

    统计

    公告


    常用链接

    留言簿(94)

    我参与的团队

    随笔分类(124)

    随笔档案(154)

    文章分类(9)

    文章档案(19)

    相册

    搜索

    积分与排名

    最新随笔

    最新评论

    阅读排行榜

    评论排行榜