Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Which can I choose for digital signature, Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT?

Algorithm School

Moderator: UNKNwYSHSA

cprgolds
Posts: 8
Joined: Thu Jan 14, 2016 4:31 am
Points :68
Contact:

Which can I choose for digital signature, Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT?

Post by cprgolds » Mon Mar 21, 2016 4:04 am

I have used this code line to initialize RSA cipher.

Code: Select all

 crypto.rsaCipher.init(keyStore.cardPrivateKey, Cipher.MODE_DECRYPT);


which is initialized as:

Code: Select all

rsaCipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false);


Now my question is I am not sure which parameter to select between Cipher.MODE_ENCRYPT and Cipher.MODE_DECRYPT to generate digital signature. Any one knows? Pls help! Any comment is appreciated.

User avatar
lostsiwonlw
Posts: 55
Joined: Fri Jul 31, 2015 9:09 pm
Points :358
Contact:

Re: Which can I choose for digital signature, Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT?

Post by lostsiwonlw » Tue Mar 22, 2016 2:22 am

Signature.MODE_SIGN
Searching for meaning...

choimillen
Posts: 30
Joined: Wed Aug 19, 2015 2:55 am
Points :213
Contact:

Re: Which can I choose for digital signature, Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT?

Post by choimillen » Tue Mar 22, 2016 2:28 am

Signature.MODE_SIGN


Using Signature.MODE_SIGN is incorrect, just in my opinion.

User avatar
mabel
Posts: 237
Joined: Mon May 18, 2015 3:09 am
Points :1705
Contact:

Re: Which can I choose for digital signature, Cipher.MODE_ENCRYPT or Cipher.MODE_DECRYPT?

Post by mabel » Tue Mar 22, 2016 3:22 am

Both Cipher.MODE_DECRYPT and Signature.MODE_SIGN work for you.

The reason is simply that Cipher.MODE_DECRYPT and Signature.MODE_SIGN both have the same integer value: 2

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 9 guests

JavaCard OS : Disclaimer