1 Star 0 Fork 9

一只很土的狼 / XiPKI

forked from Gitee 极速下载 / XiPKI 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

GitHub release License Github forks Github stars SourceSpy Dashboard

XiPKI

XiPKI (eXtensible sImple Public Key Infrastructure) is a highly scalable and high-performance open source PKI (CA and OCSP responder).

License

  • The Apache Software License, Version 2.0

Support

Just create issue or new discussion.

For bug-report please upload the testdata and log files, describe the version of XiPKI, OS and JRE/JDK, and the steps to reproduce the bug.

Prerequisite

  • OS: Linux, Windows, MacOS
  • JRE / JDK 8 (build 162+), 11, 17
  • Database: DB2, MariaDB, MySQL, Oracle, PostgreSQL, H2, HSQLDB
  • Hardware: Any available hardware (tested on Raspberry Pi 2 Model B with 900MHz quad-core ARM CPU and 1 GB Memory)

Tested PKCS#11 Devices

Performance

Test Settings

  • OS: Ubuntu 20.04, X86_64
  • CPU: Intel Core i3-7100U CPU @ 2.40GHz, 4 Core
  • Disk: SanDisk SD8SN8U (SSD)
  • Memory: 8GB
  • Cryptograhic Token: PKCS#12 keystore
  • Database: PostgreSQL 9.5
  • Database, CA server, OCSP server and test clients on the same machine.
  • Server: Apache Tomcat/8.5.34
  • Server JDK: 11.0.11+9-Ubuntu-0ubuntu2.20.04
  • Test Client: XiPKI QA, tested with 5 threads for 60 seconds.

CA

  • PostgreSQL is tuned by setting shared_buffers = 2GB and commit_delay = 1000.
  • Certificate Enrollment
Key type Key size / Curve Certificates per second
RSA 2048 630
3072 300
4096 150
DSA 2048 580
3072 330
EC NIST P-256 880
NIST P-384 700
NIST P-521 530
Brainpool P256R1 560
Brainpool P384R1 350
Brainpool P512R1 210
SM2 SM2P256V1 800
EdDSA Ed25519 1,200
Ed448 900

OCSP

  • Default PostgreSQL configuration
  • OCSP Cache Disabled
Key type Key size / Curve Responses per second
RSA 2048 880
3072 350
4096 160
DSA 2048 2,000
3072 1,000
EC NIST P-256 3,600
NIST P-384 2,400
NIST P-521 1,400
Brainpool P256R1 1,500
Brainpool P384R1 850
Brainpool P512R1 500
SM2 SM2P256V1 4,000
EdDSA Ed25519 5,000
Ed448 3,300
  • OCSP Cache enabled
    • If the OCSP requests contain nonce: same as without cache (see above).
    • Otherwise, (much) better than without cache.

Get Started

JAVA_HOME

Set the environment variable JAVA_HOME to point to root directory of the to the JRE/JDK installation.

Binaries

Download the binaries xipki-ca-<version>.zip, xipki-ocsp-<version>.zip and xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8) from releases.

Only if you want to use the development version, build it from source code as follows.

  • Get a copy of project code

    git clone https://github.com/xipki/xipki
  • Build the project

    In folder xipki

    mvn clean install -DskipTests

    Then you will find the following binaries:

    • DB Tool: assemblies/xipki-dbtool/target/xipki-dbtool-<version>.zip
    • CA: assemblies/xipki-ca/target/xipki-ca-<version>.zip
    • OCSP: assemblies/xipki-ocsp/target/xipki-ocsp-<version>.zip
    • CLI (Command Line Interface): assemblies/xipki-cli/target/xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8)

Install DB Tool

  1. Unpack the binary xipki-dbtool-<version>.zip.
  2. If you use database other than PostgreSQL, MariaDB and MySQL, you need to get the JDBC driver and copy it to the directory lib/jdbc.

Install CA Server

  1. Unpack the binary xipki-ca-<version>.zip and install CA as described in the unpacked README file.

Install OCSP Responder

Note that CA and OCSP can be installed in the same servlet container.

  1. Unpack the binary xipki-ocsp-<version>.zip and install OCSP responder as described in the unpacked README file.

Install Command Line Interface

  1. Unpack the binary xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8)
  2. Adapt the CMP client configuration xipki/cmpclient/cmpclient.json
  3. If you get "java.lang.ClassNotFoundException: <jdbc class>", please copy the missing JDBC driver jar to the directory lib/boot.

Configure PKCS#11 device (optional)

This step is only required if the real PKCS#11 device instead of the emulator is used. Note that this step should be applied to both tomcat and xipki-cli.

  • Copy xipki/security/example/pkcs11-hsm.json to xipki/security/pkcs11.json, and adapt the PKCS#11 configuration.

Configure how to handle SSL client certificate (optional)

This step is only required if the CA is behind a reverse proxy apache httpd.

  • Add the java property org.xipki.reverseproxy.mode

    -Dorg.xipki.reverseproxy.mode=APACHE
  • configure the proxy to forward the headers via mod_proxy with the following configuration

# Require SSL Client verification
SSLVerifyClient		require

#initialize the special headers to a blank value to avoid http header forgeries 
RequestHeader set SSL_CLIENT_VERIFY  "" 
RequestHeader set SSL_CLIENT_CERT  "" 

<Location / >
 RequestHeader set SSL_CLIENT_VERIFY "%{SSL_CLIENT_VERIFY}s"
 RequestHeader set SSL_CLIENT_CERT "%{SSL_CLIENT_CERT}s"
 ...
</Location>

For more details please refer to * Jetty/Howto/Configure mod proxy * Jetty: Tricks to do client certificate authentications behind a reverse proxy * Apache Module mod_ssl

Setup CA Server

  1. Start the servlet container
    HSM devices of Thales, e.g. nCipher, can use Thales preload to manage the PKCS#11 sessions. In this case, the servlet container should be started as follows
preload <start script>
  1. Setup CA in CLI
    • (If error like "Identity or Certificate with label=mylabel already exists" occurs, you need to comment the line which generate the key (e.g. dsa-p11 ec-p11, rsa-p11, sm2-p12) or delete the existing key using command delete-key-p11).

    • Start CLI.

      bin/karaf

      HSM devices of Thales, e.g. nCipher, can use Thales preload to manage the PKCS#11 sessions. In this case, the cli should be started as follows

      preload bin/karaf
    • Setup CA (choose p11 if the key is saved in PKCS#11 device, p12 in PKCS#12 device.

      • In case of using new keys and certificates, in CLI:
        source xipki/ca-setup/cacert-none/setup-*-*.script where * is place holder.

      • In case of using existing keys and certificates, in CLI:
        source xipki/ca-setup/cacert-present/setup-*-*.script where * is place holder.

      • If you wish to generate the siging key and certificate for the OCSP responder, in CLI:
        source xipki/ca-setup/setup-ocsp-*.script.

      • If you wish to add the SCEP support, in CLI:
        source xipki/ca-setup/setup-scep.script.

    • Verify the installation, execute the command in CLI:
      ca-info myca1

Enroll/Revoke Certificate and Get CRL via Shell (optional)

  • The following shell script demonstrates how to enroll and revoke certificates, and how to get the current CRL:
    <CLI_ROOT>/xipki/client-script/rest.sh (use argument 'help' to print the usage)

    Note that this script tells CA to generate real certificates. DO NOT use it in the production environment.

Enroll/Revoke Certificate

  • SCEP
    Using any SCEP client. XiPKI provides also a SCEP client.

    The binary xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8) contains an example script in the folder xipki/client-script. It can be executed in the CLI as follows:

    • source xipki/client-script/scep-client.script
  • XiPKI CLI XiPKI CLI provides commands to enroll and revoke certificates via CMP.

    The binary xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8) contains an example script in the folder xipki/client-script. It can be executed in the CLI as follows:

    • source xipki/client-script/cmp-client.script (use argument 'help' to print the usage)
  • REST API
    The shell script xipki/client-script/rest.sh of the xipki-cli demonstrates the use of REST API.

    The binary xipki-cli-<version>.tar.gz (or xipki-cli-jdk8-<version>.tar.gz for JDK 8) contains an example script in the folder xipki/client-script. It can be executed in the CLI as follows:

    • source xipki/client-script/rest-client.script (use argument 'help' to print the usage)

CLI Commands

Please refer to commands.md for more details.

Docker container

See discussion in discussion #205.

Features

  • CA (Certification Authority)

    • X.509 Certificate v3 (RFC 5280)
    • X.509 CRL v2 (RFC 5280)
    • EdDSA Certificates (RFC 8410, RFC 8032)
    • SHAKE Certificates (RFC 8692)
    • Diffie-Hellman Proof-of-Possession Algorithms (RFC 6955)
    • SCEP (RFC 8894)
    • EN 319 411 (eIDAS)
    • EN 319 412 (eIDAS)
    • Supported databases: DB2, MariaDB, MySQL, Oracle, PostgreSQL, H2, HSQLDB
    • Direct and indirect CRL
    • FullCRL and DeltaCRL
    • Customized extension to embed certificates in CRL
    • CMP (RFC 4210 and RFC 4211)
    • API to specify customized certificate profiles
    • Support of JSON-based certificate profile
    • API to specify customized publisher, e.g. for LDAP and OCSP responder
    • Support of publisher for OCSP responder
    • Public key types of certificates
      • RSA
      • EC
      • DSA
      • Ed25519, Ed448
      • SM2
      • X25519, X448
    • Signature algorithms of certificates
      • Ed25519, Ed448
      • SHAKE128withRSAPSS, SHAKE256withRSAPSS,
      • SHA3-*withRSA: where * is 224, 256, 384 and 512
      • SHA3-*withRSAandMGF1: where * is 224, 256, 384 and 512
      • SHA3-*withECDSA: where * is 224, 256, 384 and 512
      • SHA3-*withDSA: where * is 224, 256, 384 and 512
      • SHAKE128withECDSA, SHAKE256withECDSA,
      • SHA*withRSA: where * is 1, 224, 256, 384 and 512
      • SHA*withRSAandMGF1: where * is 1, 224, 256, 384 and 512
      • SHA*withECDSA: where * is 1, 224, 256, 384 and 512
      • SHA*withPlainECDSA: where * is 1, 224, 256, 384 and 512
      • SHA*withDSA: where * is 1, 224, 256, 384 and 512
      • SM3withSM2
  • Native support of X.509 extensions (other extensions can be supported by configuring it as blob)

    • AdditionalInformation (German national standard CommonPKI)
    • Admission (German national standard CommonPKI)
    • AuthorityInformationAccess (RFC 5280)
    • AuthorityKeyIdentifier (RFC 5280)
    • BasicConstraints (RFC 5280)
    • BiometricInfo (RFC 3739)
    • CertificatePolicies (RFC 5280)
    • CRLDistributionPoints (RFC 5280)
    • CT Precertificate SCTs (RFC 6962)
    • ExtendedKeyUsage (RFC 5280)
    • FreshestCRL (RFC 5280)
    • GM/T 0015 ICRegistrationNumber (企业工商注册号, Chinese Standard GM/T 0015-2012)
    • GM/T 0015 IdentityCode (个人身份标识码, Chinese Standard GM/T 0015-2012)
    • GM/T 0015 InsuranceNumber (个人社会保险号, Chinese Standard GM/T 0015-2012)
    • GM/T 0015 OrganizationCode (企业组织机构代码, Chinese Standard GM/T 0015-2012)
    • GM/T 0015 TaxationNumber (企业税号, Chinese Standard GM/T 0015-2012)
    • InhibitAnyPolicy (RFC 5280)
    • IssuerAltName (RFC 5280)
    • KeyUsage (RFC 5280)
    • NameConstraints (RFC 5280)
    • OcspNoCheck (RFC 6960)
    • PolicyConstrains (RFC 5280)
    • PolicyMappings (RFC 5280)
    • PrivateKeyUsagePeriod (RFC 5280)
    • QCStatements (RFC 3739, eIDAS standard EN 319 412)
    • Restriction (German national standard CommonPKI)
    • SMIMECapabilities (RFC 4262)
    • SubjectAltName (RFC 5280)
    • SubjectDirectoryAttributes (RFC 3739)
    • SubjectInfoAccess (RFC 5280)
    • SubjectKeyIdentifier (RFC 5280)
    • TLSFeature (RFC 7633)
    • ValidityModel (German national standard CommonPKI)
  • Management of multiple CAs in one software instance

  • Support of database cluster

  • Multiple software instances (all can be in active mode) for the same CA

  • Native support of management of CA via embedded OSGi commands

  • API to manage CA. This allows one to implement proprietary CLI, e.g. Website, to manage CA.

  • Database tool (export and import CA database) simplifies the switch of databases, upgrade of XiPKi and switch from other CA system to XiPKI CA

  • All configuration of CA except those of databases is saved in database

  • OCSP Responder

    • OCSP Responder (RFC 2560 and RFC 6960)
    • Configurable Length of Nonce (RFC 8954)
    • Support of Common PKI 2.0
    • Management of multiple certificate status sources
    • Support of certificate status source based on the database of XiPKI CA
    • Support of certificate status source based on the OCSP database published by XiPKI CA
    • Support of certificate status source CRL and DeltaCRL
    • Support of certificate status source published by EJBCA
    • API to support proprietary certificate sources
    • Support of both unsigned and signed OCSP requests
    • Multiple software instances (all can be in active mode) for the same OCSP signer and certificate status sources.
    • Supported databases: DB2, MariaDB, MySQL, Oracle, PostgreSQL, H2, HSQLDB
    • Database tool (export and import OCSP database) simplifies the switch of databases, upgrade of XiPKi and switch from other OCSP system to XiPKI OCSP.
    • High performance
    • Support of health check
  • SCEP

    • Supported SCEP versions
      • RFC 8894
  • CLI

    • Configurating CA
    • Client to enroll, revoke, unrevoke and remove certificates, to generate and download CRLs
    • Client to send OCSP request
    • Generating keypairs of RSA, EC and DSA in token
    • Deleting keypairs and certificates from token
    • Updating certificates in token
    • Generating CSR (PKCS#10 request)
    • Exporting certificate from token
    • High performance
    • Support of health check
  • For CA, OCSP Responder, and CLI

    • Support of PKCS#12 and JCEKS keystore
    • Support of PKCS#11 devices, e.g. HSM
    • API to use customized key types, e.g. smartcard
    • API to resolve password
    • Support of PBE (password based encryption) password resolver
      • All passwords can be encrypted by the master password
    • Support of OBF (as in jetty) password resolver

Use OCSP with customized Certificate Status Source (OcspStore)

  • See the example modules
    • ocsp-store-example: implementation of a customized OcspStore.
    • ocsp-store-example-assembly: assembly the binaries.
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

XiPKI (eXtensible sImple Public Key Infrastructure) 是一个高度可伸缩和高性能的开源 PKI 实现(CA and OCSP res 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ygypc_spring/XiPKI.git
git@gitee.com:ygypc_spring/XiPKI.git
ygypc_spring
XiPKI
XiPKI
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891