Giter Club home page Giter Club logo

pkcs11wrapper's Introduction

GitHub release License Github forks Github stars

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 new issue.

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

Get Started

Binaries

The binary xipki-setup-<version>.zip can be retrieved using one of the following methods

Install and Setup

Unpack xipki-setup-<version>.zip and follow the xipki-setup-<version>/INSTALL.md.

Features

Supported Platform

CA Protocol Gateway

  • EST (RFC 7030)
  • SCEP (RFC 8894)
  • CMP (RFC 4210, 4211, 9045, 9480)
  • ACME (RFC 8555, RFC 8737)
    • Challenge types: dns-01, http-01, tls-apln-01
  • RESTful API (XiPKI own API)

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)
  • EN 319 411 and 319 412 (eIDAS)
  • Direct and indirect CRL
  • FullCRL and DeltaCRL
  • 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
    • DSA with hash algorithms: SHA-1, SHA-2, and SHA-3
    • ECDSA with hash algorithms: SHA-1, SHA-2, SHA-3, and SHAKE
    • Ed25519, Ed448
    • Plain ECDSA with hash algorithms: SHA-1, and SHA-2
    • RSA PKCS1v1.5 with hash algorithms: SHA-1, SHA-2, and SHA-3
    • RSA PSS with hash algorithms: SHA-1, SHA-2, and SHA-3, and SHAKE
    • SM3withSM2
  • Native support of X.509 extensions (other extensions can be supported by configuring it as blob)
    • RFC 3739
      • BiometricInfo
      • QCStatements (also in eIDAS standard EN 319 412)
      • SubjectDirectoryAttributes
    • RFC 4262
      • SMIMECapabilities
    • RFC 5280
      • AuthorityInformationAccess, AuthorityKeyIdentifier
      • BasicConstraints
      • CertificatePolicies, CRLDistributionPoints
      • ExtendedKeyUsage
      • FreshestCRL
      • InhibitAnyPolicy, IssuerAltName
      • KeyUsage
      • NameConstraints
      • PolicyConstrains, PolicyMappings, PrivateKeyUsagePeriod
      • SubjectAltName, SubjectInfoAccess, SubjectKeyIdentifier
    • RFC 6960
      • OcspNoCheck
    • RFC 6962
      • CT Precertificate SCTs
    • RfC 7633
      • TLSFeature
    • Car Connectivity Consortium
      • ExtensionSchema
    • Common PKI (German national standard)
      • AdditionalInformation, Admission
      • Restriction
      • ValidityModel
    • GM/T 0015-2012 (Chinese national standard)
      • ICRegistrationNumber, IdentityCode, InsuranceNumber
      • OrganizationCode
      • TaxationNumber
  • 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 sources
    • Database of XiPKI CA
    • OCSP database published by XiPKI CA
    • CRL and DeltaCRL
    • Database of 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.
  • 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

Mgmt CLI (Management Client)

  • Configuring CA
  • 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

CLI (CA/OCSP Client)

  • Client to enroll, revoke, and unrevoke (unsuspend) certificates, to download CRLs
  • Client to send OCSP request
  • Updating certificates in token
  • Generating CSR (PKCS#10 request)
  • Exporting certificate from token

HSM Proxy

  • Provide the access to the HSM remotely.

pkcs11wrapper's People

Contributors

xipki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pkcs11wrapper's Issues

CKM_AES_CMAC sign produce a 64 bit MAC instead 128 bit

Hi Xipki,
i tring to generate an AES CMAC using a 128 bit key but i receive a 64 bit MAC instead 128 bit. I saw that

...References [NIST SP800-38B] and [RFC 4493] recommend that the output MAC is not truncated to less
than 64 bits. The MAC length must be specified before the communication starts, and must not be
changed during the lifetime of the key...

i use a simple code to generate mac but i don't konw how specify MAC length, seems that CKM_AES_CMAC have not parameter

Mechanism mech = new Mechanism(PKCS11Constants.CKM_AES_CMAC);
((Session) session).signInit(mech, (Key) key);
byte[] signedData = ((Session) session).sign(data);

could you help me ?

2021-09-29 update: seems that could be an HSM bug, SafeNet ProtectServer appliance. I opened a case on Thales Customer Support system. I will keep the post updated.

Getting "WARNING: An illegal reflective access operation has occurred"

When performing any PKCS11 cryptographic operation using Java 11, I'm getting similar warnings in the console: (example is for GCM encryption)

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by iaik.pkcs.pkcs11.parameters.GCMParameters (file:/C:/Users/{user}/.m2/repository/org/xipki/iaik/sunpkcs11-wrapper/1.4.7/sunpkcs11-wrapper-1.4.7.jar) to constructor sun.security.pkcs11.wrapper.CK_GCM_PARAMS(int,byte[],byte[])
WARNING: Please consider reporting this to the maintainers of iaik.pkcs.pkcs11.parameters.GCMParameters
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

The operation is nevertheless successful, but from the message it looks like it might eventually stop working for newer versions of Java.

Java version: openjdk 11.0.10 2021-01-19

Use pkcs11wrapper as SunPKCS11 provider

Hi Xipki, i would like to use a private key in my HSM Safenet into an SSL Connection, i saw that should use
Provider p = new SunPKCS11("/home/test/pkcs11.cfg")

should i use libcryptoki.so of Safenet or could also use pkcs11wrapper ? I haven't found some examples.
Could you help me ?

info about right pattern on hsm restart

Hi Xipki, i would like to implement a right pattern in case of restart hsm necessary.
I saw that, after i restarted hsm, i received this error on next use
Unknwon mechanism with code: 0x0000000080000384

Which should be a right pattern ?

  • Is there a method to check module state ? So i could try to check state before perform operations.
  • If there is a specific exception, i could try to manage exception and launch reinit module (should i finalize and initialize in this case ?)
  • i could try to use getInfo() to detect if module state is no good ?
  • Should i shutdown and restart application completely ?

RSASSA-PSS with SHA256 return CKR_MECHANISM_INVALID

Hi Xipki,
i trying to generate signature using mechanism PKCS11Constants.CKM_SHA256_RSA_PKCS_PSS and params:

iaik.pkcs.pkcs11.parameters.Parameters mechParams = new RSAPkcsPssParameters(Mechanism.get(PKCS11Constants.CKM_SHA256),
		PKCS11Constants.CKG_MGF1_SHA256, new SHA256Digest().getDigestSize());

but i receive always CKR_MECHANISM_INVALID

i saw also that RSAPkcsPssParameters was deprecated but i doesn't found any new pattern.

Could you help me ?

chore : Unknwon instead of Unknown in mechanismCodeToString()

 public static String mechanismCodeToString(long mechCode) {
    initMechanismMap();
    String name = mechCodeNamesAvailable ? mechNames.get(mechCode) : null;

    if (name == null) {
      name = "Unknwon mechanism with code: 0x" + toFullHex(mechCode);
    }

    return name;
  }

Decrypt with CKM_RSA_PKCS_OAEP mechanism return... Unsupported Parameters

Hi,
i trying to use CKM_RSA_PKCS_OAEP to decrypt using an RSA private key. I using this parameters:

Mechanism mech = new Mechanism(PKCS11Constants.CKM_RSA_PKCS_OAEP);

RSAPkcsOaepParameters params = new RSAPkcsOaepParameters(
    PKCS11Constants.CKM_SHA_1, 
    PKCS11Constants.CKG_MGF1_SHA1,
    PKCS11Constants.CKZ_SALT_SPECIFIED, 
    null);

mech.setParameters(params);

but when i try to

session.decryptInit(mech, keyToUse);

i receive always

Unsupported Parameters iaik.pkcs.pkcs11.parameters.RSAPkcsOaepParameters

i tested feature using the same parameters with a .Net PKCS11Interop and it work only using
Net.Pkcs11Interop.HighLevelAPI80.MechanismParams.CkRsaPkcsOaepParams

could you help me ?

use xipki/pkcs11wrapper instead mikma/pkcs11wrapper

Hi xipki,
i trying to use your wrapper instead mikma but i saw that some objects are missing:
iaik.pkcs.pkcs11.objects.AESSecretKey
iaik.pkcs.pkcs11.objects.ECDSAPrivateKey
iaik.pkcs.pkcs11.objects.ECDSAPublicKey
iaik.pkcs.pkcs11.objects.Object
iaik.pkcs.pkcs11.parameters.Parameters
iaik.pkcs.pkcs11.wrapper.PKCS11Constants
iaik.pkcs.pkcs11.wrapper.Functions

and some methods:
Token.closeAllSessions()
Session.destroyObject(PKCS11Object)

have you planning a roadmap for porting ?

regards
Armando

sunPKCS11 on Java 9+

Hello,

Currently I work on a cryptography project where we implement all communication with HSM using sunPKCS11, however in the most current versions of Java the sunPKCS11 package is no longer directly accessible, and being encapsulated in a provider, something that limits a lot of our work, especially the use of DES2 keys among other functions.

This project also directly accesses the sunPKCS11 classes (ex. import sun.security.pkcs11.wrapper.PKCS11). I would like to know if you already have any idea how this will be solved using Java version 11 for example.

All the best, thank you.

Pass CKA_VALUE into secretkey template

Hi Xipki,
i trying to pass CKA_VALUE for a CKK_DES2 test key but i receive always:
Unsupported attribute 0x11 for iaik.pkcs.pkcs11.objects.SecretKey.

I use:

byte[] keyValue = new byte[] { ... };
SecretKey key_template = SecretKey();
((SecretKey) key_template).getLabel().setValue("TESTKEY-LABEL".toCharArray());
key_template.putAttribute(PKCS11Constants.CKA_TOKEN, true);
key_template.putAttribute(PKCS11Constants.CKA_KEY_TYPE, PKCS11Constants.CKK_DES2);
...
key_template.putAttribute(PKCS11Constants.CKA_VALUE, keyValue);

((Session) session).createObject(key_template);

Could you help me ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.