天天看点

EJBCA 在windows上的安装

为了做EJBCA的封装测试,在我自己电脑上装了个,但是在国内的开发上面的介绍实在是太少,有的也只是些傻瓜式的安装介绍,这是介绍在Windows上安装的过程,(后面介绍下 linux 红帽上的),有些也是在网上看看,有一些比较关键的地方 在下面会指出来:

推荐一个比较不错的网址:https://sourceforge.net/p/ejbca/discussion/

EJBCA是一个基于J2EE技术的全功能的开源CA系统软件,并提供了一个强大的、高性能并基于组件的CA。EJBCA兼具灵活性和平台独立性,能够独立使用,也能和任何J2EE应用程序集成。

特性:网上很多 不说了。

使用的软件清单(我自己在CSDN上上传的):

J2SE6

jce_policy-6.zip

JDK 1.6 update 12和JCE Unlimited Strength Jurisdiction Policy Files 6 Release Candidate

JBoss:

JBoss-5.0.1.GA-jdk6 (注意请下载JBoss-5.0.1.GA-jdk6.zip)  这个120兆太大了传不了。

去官方网站转了半天不知道再哪下载,于是去了sourceforge。

EJBCA:

ejbca_4_0_10  

http://download.csdn.net/detail/liweifengwf/7391473

或者官网:

ANT:

apache-ant-1.8.4   

MySQL:

MySQL 5.1     

mysql-connector-java-5.1.7.zip   

安装步骤:

1、安装j2se6;

还有就是 解压jce_policy,并将解压后的jce_policy-1_4_2\jce中的local_policy.jar和US_export_policy.jar复

制,覆盖C:\Program Files\Java\j2re1.4.2_02\lib\security中的同名文件。。

2、安装mysql。用户名密码均为"root”。运行开始菜单里的mysql command line client命令行工具,输入口令"root",并建立一个空数据库ejbca,命令行为"create database ejbca;"。而后退出命令行工具,他会自己把需要的建好 不用操心。

3、解压ejbca、jboss、ant到C盘根目录下。

4、mysql的jar文件,

把mysql-connector-java-5.1.7.zip里的mysql-connector-java-5.1.7-bin.jar拷贝到%JBOSS_HOME%/server/default/lib目录下。

5、设置环境变量。(这个就不用细说了,记得在配置好后 把cmd的窗口关了在打开)

JAVA_HOME = C:/Program Files/Java/jdk1.6.0_12

JBOSS_HOME = C:/jboss-5.0.1.GA

ANT_HOME = C:/apache-ant-1.7.1

ANT_OPTS = -Xmx640m

PATH = %JAVA_HOME%/BIN;%JBOSS_HOME%/BIN;%ANT_HOME%/bin;

CLASSPATH= %JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar;%JAVA_HOME%/lib;

6、运行jboss的run.bat。待jboss完全启动后,在浏览器中访问 ,出现jboss欢迎页面便表示jboss成功运行。然后一定要停止jboss运行。

7.配置ejbca

将%EJBCA_HOME%/conf/ejbca.properties.sample 复制保存为   %EJBCA_HOME%/conf/ejbca.properties

记得一定要修改ejbca.properties文件下标红地方

这个文件中的下面红色部分:

# To prevent accidental runs of tests or deploying the wrong thing in a production

# environment, we could prevent this by setting this variable to either "ca" or "ocsp"

ejbca.productionmode=ca

#ejbca.productionmode=ocsp

将%EJBCA_HOME%/conf/web.properties.sample,复制保存为   %EJBCA_HOME%/conf/web.properties

将%EJBCA_HOME%/conf/database.properties.sample复制保存为%EJBCA_HOME%/conf/database.properties

编辑database.properties如下 (主要是标色的地方下文中没有‘#‘的几行在原文件中是有‘#‘,修改就是把‘#‘去掉)

# ------------- Database configuration ------------------------

# jndi name of the datasource to use in deployment descriptors of ejbs.

# default: EjbcaDS

#datasource.jndi-name=EjbcaDS

# Prefix for the jndi name of the datasource to use in deployment descriptors of ejbs. 

# JBoss requires ‘java:/‘ as prefix, while Weblogic does not want anything (‘‘), and Glassfish wants jdbc/

# Oracle usually uses jdbc/ as well.

# For Websphere use jdbc/.

# default: java:/

#datasource.jndi-name-prefix=java:/

#datasource.jndi-name-prefix=

#datasource.jndi-name-prefix=jdbc/

# Weblogic in combination with Oracle requires special handling of LONG/BLOB columns

# If, and only if, you are using Weblogic and Oracle, uncomment the row below.

# Use OracleBlob in Weblogic 8.x and Blob in Weblogic 9.x

# Note: This setting is not needed in Weblogic 9.2. Leave it commented out.

# default: 

#[email protected] Blob

# The database name selected for deployment, used to copy XDoclet merge files.

# All supported databases are defined below, others can easily be added

# See the document doc/howto/HOWTO-database.txt for database specifics and tips and tricks.

# Default: hsqldb

database.name=mysql

#database.name=postgres

#database.name=mssql2000

#database.name=oracle

#database.name=sapdb

#database.name=sybase

#database.name=informix

#database.name=derby

#database.name=db2

# The datasource mapping selected for deployment.

# The J2EE server needs to be configured with the appropriate datasource mapping. 

# For JBoss this maps to a setting in standardjbosscmp-jdbc.xml and must match the database chosen above.

# All supported mappings are defined below, others can easily be added

# Default: Hypersonic SQL

datasource.mapping=mySQL

#datasource.mapping=PostgreSQL 7.2

#datasource.mapping=PostgreSQL 8.0

#datasource.mapping=MS SQLSERVER2000

#datasource.mapping=Oracle8

#datasource.mapping=Oracle9i

#datasource.mapping=SapDB

#datasource.mapping=Sybase

#datasource.mapping=Informix92

#datasource.mapping=InformixDB

#datasource.mapping=Derby

#datasource.mapping=DB2

# Database connection url.

# This is the URL used to connect to the database, used to configure a new datasource in JBoss.

# Default: jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB

#database.url=jdbc:mysql://127.0.0.1:3306/ejbca

database.url=jdbc:mysql://127.0.0.1:3306/ejbca?characterEncoding=UTF-8

#database.url=jdbc:postgresql://127.0.0.1/ejbca

#database.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ejbca

#database.url=jdbc:oracle:thin:@127.0.0.1:1521:ejbca

#database.url=jdbc:datadirect:oracle://127.0.0.1:1521;SID=ejbca

#database.url=jdbc:informix-sqli://127.0.0.1:1525/ejbca:informixserver=mydbservername;DBDATE=DMY4/;

#database.url=jdbc:derby://127.0.0.1/ejbca;create=true

#database.url=jdbc:db2://127.0.0.1:50000/ejbca

# JDBC driver classname.

# The J2EE server needs to be configured with the appropriate JDBC driver for the selected database

# Default: org.hsqldb.jdbcDriver

database.driver=com.mysql.jdbc.Driver

#database.driver=org.postgresql.Driver

#database.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver

#database.driver=oracle.jdbc.driver.OracleDriver

#database.driver=com.ddtek.jdbc.oracle.OracleDriver

#database.driver=com.informix.jdbc.IfxDriver

#database.driver=org.apache.derby.jdbc.ClientDriver

#database.driver=com.ibm.db2.jcc.DB2Driver

# Database username.

# Default: sa (works with hsqldb)

#database.username=ejbca

#database.username=postgres

database.username=root

# Database password.

# Default: (blank works with hsqldb)

#database.password=ejbca

#database.password=postgres

database.password=root

 配置完了,接下来就按下面的步骤走就行;

8.cmd到%EJBCA_HOME%目录下,运行ant bootstrap,进行ejbca的编译(如果是老的版本需要在编译之后把C:\ejbca_4_0_10\dist下的ejbca.ear文件拷到C:\jboss-5.1.0.GA\server\default\deploy目录下,新版本会自动编译进去的)。

EJBCA 在windows上的安装

出现Total time 表明 编译完成。

9、不用切换目录,敲入start run.bat,启动jboss控制台(会单独起来一个窗口,这个jboss启动的目录不要关)。

EJBCA 在windows上的安装
EJBCA 在windows上的安装

出现Started in tIime 表明jboss启动完成。

10、不用切换目录,敲入ant install 进行ejbca的安装(安装会生成p12文件,如无此文件,检查前几步是否有漏项)。(注意)在jboss的启动窗口如果出现JCE

cannot authenticate the provider BC错误,把%EJBCA_HOME%/lib/bc*.jar拷贝到%JBOSS_HOME%server/default/lib下。如下图:

EJBCA 在windows上的安装

安装时候 注意jboss的启动窗口的日志,出错的时候 上面的比较清楚。

11、按一下Ctrl+C,停止JBOSS。

12、不用切换目录,敲入ant deploy,进行ejbca的部署。

EJBCA 在windows上的安装

出现Total time EJBCA安装完成。

13、去%EJBCA_HOME%/p12下,安装superadmin.p12证书,口令为"ejbca"。

修改默认证书密码:(修改默认密码在%EJBCA_HOME%\conf\web.properties\superadmin.password=ejbca)

14、安装成功。

cmd到%EJBCA_HOME%目录下,运行run.bat启动JBOSS。

在ie地址栏中敲入https://localhost:8443/ejbca/administrator出现证书选择对话框,选择SuperAdmin证书后出现管理控制台页面:

EJBCA 在windows上的安装