面 向 海 洋 信 息 管 理 的 轻 量 级 CA 的 设 计 与 实 现 丁 明, 周 林, 韩 京 云, 宋 庆 磊, 宋 转 玲, 李 新 放, 刘 海 行 (, 266061) 摘 要 : 面 向 海 洋 信 息 管 理 的 需 求, 基 于 J2EE 平 台, 使 用 Bouncy Castle 提 供 的 加 密 算 法 与 工 具, 遵 从 PKI(Public Key Infrastructure, 公 钥 基 础 设 施 ) 相 关 标 准, 实 现 了 一 个 适 用 于 中 小 型 海 洋 信 息 管 理 系 统 的 轻 量 级 数 字 证 书 认 证 机 构 (CA, Certificate Authority) 该 CA 提 供 了 适 用 于 中 小 型 海 洋 信 息 管 理 系 统 的 数 据 存 储 与 传 输 加 密 功 能, 为 通 过 网 络 实 现 高 效 的 海 洋 科 研 数 据 收 集 与 共 享 管 理 提 供 了 技 术 上 的 安 全 保 障 关 键 词 : 海 洋 信 息 安 全 ; 海 洋 信 息 管 理 ; Bouncy Castle; 数 字 证 书 认 证 机 构 (CA, Certificate Authority); 加 密 中 图 分 类 号 : TP309 文 献 标 识 码 : A 文 章 编 号 : 1000-3096(2014)02-0091-05 doi: 10.11759/hykx20121005001,,,, [1], [2],,,,, [3],, (CA, Certificate Authority) [4] CA, PKI(Public Key Infrastructure, ), [5] CA,, Bouncy Castle API, CA, CA ;, 100 CA, [6], CA,,,,, Bouncy Castle J2EE, CA, 1 系 统 功 能 需 求 [7], CA,,,,, CA 1 : 2012-10-05; : 2012-12-24 : (2011T03); (2008AA09A40105) : (1977-),,,,,, : 0532-88961476, E-mail: ding@fio.org.cn;,,, : 0532-88967412, E mail: liuhx@fio.org.cn Marine Sciences / Vol. 38, No. 2 / 2014 91
Fig. 1 1 CA The functional architecture provided by lightweight CA for marine management information 1.1 证 书 生 成 与 签 发 功 能 CA, CA : X.509 V3 ; SSL ; Web Server ; S/MIME 1.2 证 书 应 用 管 理 功 能 : 1.3 CRL 管 理 功 能 CRL(Certificate Revocation List) CRL CA, CRL, CRL CRL Web, 1.4 用 户 管 理 功 能,,,, 2 系 统 结 构 设 计, (RA, Registration Authority) CA CA, 2 : RA, RA,,, CA 2 CA Fig. 2 Architecture of lightweight CA for marine management information : CA CA,, (CRL), LDAP OCSP, 3 系 统 实 现 3.1 开 发 平 台,, J2EE, Bouncy Castle Java, Java : Java Java Java,,, Java 92 / 2014 / 38 / 2
: Java Security, Java API java.security, Java JCA (Java Cryptography Architecture) JCE(Java Cryptography Extension) JCA, ; JCE JCA, API, [8] Bouncy Castle: JCA/JCE,, Bouncy Castle Bouncy Castle, : JAVA C# API JCE/JCA provider X.509, CRLs, PKCS12, S/MIME, OCSP 3.2 具 体 实 现 CA J2EE, CA, CA // RSA, kp KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); SecureRandom random = new java.security.securerandom(); kpg.initialize(2048, random); KeyPair kp = kpg.generatekeypair(); // PKCS#12 Security.addProvider(new BouncyCastleProvider()); KeyPair kp=new genkeypair();//genkeypair PrivateKey caprivkey = kp.getprivate(); PublicKey capubkey = kp.getpublic(); //, DN String issuer = "C=CN, ST=ShanDong, O=FIO, OU=micc, CN=caOcean, L=QingDao"; X509V3CertificateGenerator v3certgen = new X509V3CertificateGenerator(); v3certgen.setissuerdn(new X509Principal(issuer)); // CDP(CRL Distribution Point) DistributionPoint[] dp = new DistributionPoint[1]; DistributionPointName dpn=new DistributionPointName( ); dp[0] = new DistributionPoint(dpn, null, null); v3certgen.addextension(x509extensions.crldistributionpoints, false, new CRLDistPoint(dp)); v3certgen.addextension(x509extensions.authoritykeyidentifier, false, new AuthorityKeyIdentifier- Structure(caPubKey)); v3certgen.addextension(x509extensions.basic- Constraints, false, new BasicConstraints(0)); X509Certificate cert = v3certgen.generate(caprivkey); // v3certgen.setissuerdn(principalutil.getsubject- X509Principal(caCert)); v3certgen.addextension(x509extensions.basic- Constraints, false, new org.bouncycastle.asn1.x509.basicconstraints(false)); // (CRL) // ReadP12Cert readthecer = new ReadP12Cert(); KeyPair kp = readthecer.getkeypair(); X509Certificate cacert = readthecer.getcertificate(); //, CRL PrivateKey caprivkey = kp.getprivate(); PublicKey capubkey = kp.getpublic(); org.bouncycastle.asn1.x509.x509name issuser- DDN = new org.bouncycastle.asn1.x509.x509name (cacert.getissuerdn().tostring()); // crl //X509V2CRLGenerator crlgenerator = new X50-9V2CRLGenerator(); crlgenerator.setsignaturealgorithm("sha1with- RSAEncryption"); crlgenerator.setthisupdate(new java.util.date()); // 175 crlgenerator.addcrlentry(biginteger.valueof(0x- 00af), new java.util.date(), CRLReason.keyCompromise); X509CRL mycrl = crlgenerator.generate (caprivkey); 4 CA 系 统 应 用 实 例, CA, CA,, CA,,,, CA Marine Sciences / Vol. 38, No. 2 / 2014 93
, RSA,, (Digital Envelope), AES(Advanced Encryption Standard) 256,,,,,,,,,, CA, : SHA1,,, CA, SHA1,,, CA,,,, CA : 1), [9] 2) B/S,,, 3), CA, CA, 4) X.509 V3, PKI GB/T19713-2005 GB/T 19714-2005,,,, [10],, CA,, CA,, : [1]. [R]. :, 2008. [2]. [J]., 2009, 32(4): 828. [3],. [J]., 2012, 7: 60. [4]. PKI [J]., 2009, 38( ): 101. [5]. PKI [M]. :, 2008: 69-70. [6],,,. [J]., 2012, 36(02): 110. [7],,,. [J]., 2007, 18(4): 457. [8],. PKI [M]. :, 2008: 279. [9],,. PKI/CA [J]., 2006, 32(4): 190. [10],,,. [J]., 2010, 12(5): 681. 94 / 2014 / 38 / 2
Design and implementation of lightweight CA for marine information management DING Ming, ZHOU Lin, HAN Jing-yun, SONG Qing-lei, SONG Zhuan-ling, LI Xin-fang, LIU Hai-xing (Marine Information and Computing Center, the First Institute of Oceanography, State Oceanic Administration, Qingdao 266061, China) Received: Oct., 5, 2012 Key words: marine information security; marine management information; Bouncy Castle; CA (Certificate Authority); encryption Abstract: In order to meet marine information management requirement, in this paper, we have successfully set up a lightweight CA (Certificate Authority) which is suitable for various small marine management information systems. The achievement of this lightweight CA was based on the J2EE platform, based on, using Bouncy Castle encryption algorithms and tools and conforming to PKI (Public Key Infrastructure) standard. The CA provides encryption function for data storage and transmission to small and medium marine management information systems, It can offer efficient protection for transfer and sharing of marine scientific information. ( 本 文 编 辑 : 刘 珊 珊 李 晓 燕 ) Marine Sciences / Vol. 38, No. 2 / 2014 95