Do hash on PC and send digest to my card for signing

Algorithm School

Moderator: UNKNwYSHSA

Christy16
Posts: 12
Joined: Wed Dec 21, 2016 11:45 pm
Points :168
Contact:

Do hash on PC and send digest to my card for signing

Post by Christy16 » Tue Mar 14, 2017 3:33 am

My card supports ALG_ECDSA_SHA. As we all know,for java card, hash calculation is time-consuming,let along data transferring time. Thus I want to do hash on pc and then send digest to my card for signing.
But I don't know how to do this. Any help?
Last edited by Christy16 on Tue Mar 14, 2017 6:11 am, edited 1 time in total.

popmun09
Posts: 36
Joined: Tue Feb 16, 2016 9:49 pm
Points :230
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by popmun09 » Tue Mar 14, 2017 5:14 am

Try to use cipher instead of hash.

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

Re: Do hash on PC and send digest to my card for signing

Post by mabel » Tue Mar 14, 2017 6:18 am

Use signPreComputedHash, which can help you generate the signature of the precomputed hash data. But you java card version should support
since 3.

Detailed info:
signPreComputedHash

public abstract short signPreComputedHash(byte[] hashBuff,
short hashOff,
short hashLength,
byte[] sigBuff,
short sigOffset)
throws CryptoException

Generates the signature of the precomputed hash data.

A call to this method also resets this Signature object to the state it was in when previously initialized via a call to init(). That is, the object is reset and available to sign another precomputed hash.

Note:
This method throws an exception if the underlying signature algorithm does not compute a distinct message digest value prior to applying cryptographic primitives. These algorithms throw exception - DES, triple DES, AES, and KOREAN SEED.
Any data previously accumulated from previous calls to the update method are discarded.
The hash and output buffer data may overlap.

Parameters:
hashBuff - the input buffer of precomputed hash to be signed
hashOffset - the offset into the buffer where the hash begins
hashLength - the byte length of the hash
sigBuff - the output buffer to store signature data
sigOffset - the offset into sigBuff at which to begin signature data

Returns:
number of bytes of signature output in sigBuff

Throws:
CryptoException - with the following reason codes:
CryptoException.UNINITIALIZED_KEY if key not initialized.
CryptoException.INVALID_INIT if this Signature object is not initialized or initialized for signature verify mode.
CryptoException.ILLEGAL_USE if one of the following conditions is met:
if the hashLength value is not equal to the length of the algorithm's message digest length.
if this Signature algorithm includes message recovery functionality.
if the Signature algorithm does not compute a distinct message digest value prior to applying cryptographic primitives



Sheley
Posts: 1
Joined: Tue Jul 04, 2017 5:54 am
Points :12
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by Sheley » Tue Jul 11, 2017 2:26 am

popmun09 wrote:Try to use cipher instead of hash.


Why's that?

Arynews
Posts: 1
Joined: Wed Apr 04, 2018 7:39 am
Points :12
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by Arynews » Wed Apr 04, 2018 7:40 am

Use signPreComputedHash, which can help you generate the signature of the precomputed hash data. elections results But you java card version should support since 3.

timros
Posts: 2
Joined: Mon Jun 04, 2018 9:04 am
Points :12
Location: United States
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by timros » Mon Jun 04, 2018 9:11 am

Why's that?[/quote]

It is clear why
The crazy bulk could be quite a good help https://diets-usa.com/crazy-bulk-reviews/

timros
Posts: 2
Joined: Mon Jun 04, 2018 9:04 am
Points :12
Location: United States
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by timros » Mon Jun 04, 2018 9:12 am

good info
The crazy bulk could be quite a good help https://diets-usa.com/crazy-bulk-reviews/

scotmaria
Posts: 1
Joined: Fri Jun 22, 2018 3:14 am
Points :8
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by scotmaria » Fri Jun 22, 2018 3:27 am

A call to this method also resets this Signature object to the state it was in when previously initialized via a call to init(). That is, the object is reset and available to sign another precomputed hash.

Arydigital
Posts: 1
Joined: Thu Jul 19, 2018 3:51 am
Points :12
Contact:

Re: Do hash on PC and send digest to my card for signing

Post by Arydigital » Thu Jul 19, 2018 3:54 am

popmun09 wrote:Try to use cipher https://www.arydigital.tv/videos/catego ... hand-rakh/ instead of hash.
Why's that?

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer