Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JC 3.0.4 Signature.getInstance() 3-parameter modes

Matti AarnioNov 10 2017 — edited Apr 10 2018

The JC 3.0.4 API defines new getInstance() form for Signature, Cipher and few others.

I would like to use this Signature.getInstance(byte,byte,byte,boolean) to instantiate this kind of combination:

Signature.getInstance(MessageDigest.ALG_SHA_256, Signature.SIG_CIPHER_RSA, Cipher.PAD_PKCS1, false);

Signature.getInstance(MessageDigest.ALG_NULL, Signature.SIG_CIPHER_RSA, Cipher.PAD_PKCS1, false);

then using  sig.signPreComputedHash(...)  method to do signing.

The first form works, but puts ASN.1 DER wrapper with OID of SHA-256 around the supplied data.

I would like to use the second form supplying pre-wrapped data on a material using one of myriad digest algorithms that Java Card does not support.

Essentially I want to do with Signature API what I can do with Cipher API:

Cipher c = Cipher.getInstance(Cipger.ALG_RSA_PKCS1, false);

c.init(keyPair.getPrivate(), Cipher.MODE_ENCRYPT);

short len = c.doFinal(buffer, offset, length,  buffer, offset);

The public specifications (JC 3.0.4/3.0.5) are not telling what parameter combinations should be supported in this Signature mode.

Can anybody identify which public document describes these modes in JC 3.0.4 ?

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 8 2018
Added on Nov 10 2017
5 comments
889 views