# Nitrokey HSM and Java

**URL:** <https://support.nitrokey.com/t/nitrokey-hsm-and-java/2656>\
**Category:** Misc\
**Created:** [September 24, 2020, 8:28pm UTC](https://support.nitrokey.com/t/nitrokey-hsm-and-java/2656 "2020-09-24T20:28:38Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![weydstone](https://support.nitrokey.com/letter_avatar_proxy/v4/letter/w/34f0e0/32.png) [@weydstone](https://support.nitrokey.com/u/weydstone)\
**Post date:** [September 25, 2020, 4:08pm UTC](https://support.nitrokey.com/t/nitrokey-hsm-and-java/2656/6 "2020-09-25T16:08:58Z")

</div>

I’m currently using Java 15. And it still seems odd to me that OpenSC-Java would not implement  
SignatureSpi.engineGetParameters since that is a defined interface method.

But regardless, attempting to create a PKCS10 object with Bouncy Castle fails with this exception:

```
Exception in thread "main" java.lang.IllegalArgumentException: unknown object in getInstance: org.bouncycastle.asn1.ASN1Integer
    at org.bouncycastle.asn1.ASN1Sequence.getInstance(ASN1Sequence.java:105)
    at org.bouncycastle.asn1.x509.AlgorithmIdentifier.getInstance(AlgorithmIdentifier.java:34)
    at org.bouncycastle.asn1.x509.SubjectPublicKeyInfo.<init>(SubjectPublicKeyInfo.java:80)
    at org.bouncycastle.asn1.x509.SubjectPublicKeyInfo.getInstance(SubjectPublicKeyInfo.java:43)
    at org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder.<init>(Unknown Source)

```

I have used this method with other PKCS #11 implementations without this issue, but I need to take a closer look to see if this is something I can work around.

In the meantime, do you have any advice about ECC support. The Nitrokey HSM apparently supports ECC key pairs, but the OpenSC-Java libraries don’t have wrappers for this key type. Any suggestions?

---

_[View the full topic](https://support.nitrokey.com/t/nitrokey-hsm-and-java/2656)._
