@@ -24,8 +24,8 @@ public class MPCApplet extends Applet {
24
24
// TODO: Enable/disable propagation of private key to other quorum
25
25
// TODO: Generate unique card key for signatures
26
26
// TODO: Make unified structure of input data Sign(QuorumContextIndex | command apdu)_CardKey
27
+ // TODO: unify response codes
27
28
28
- Bignat Sign_counter = null ; // TODO: move into shared temp values
29
29
QuorumContext [] m_quorums = null ;
30
30
31
31
public byte [] cardIDLong = null ; // unique card ID generated during applet install
@@ -46,10 +46,6 @@ public MPCApplet() {
46
46
m_quorums [i ] = new QuorumContext (m_ecc , m_curve , m_cryptoOps );
47
47
}
48
48
49
- Sign_counter = new Bignat ((short ) 2 , JCSystem .MEMORY_TYPE_TRANSIENT_RESET , m_ecc .bnh );
50
-
51
-
52
-
53
49
/*// Signing - older protocol with explicit hash
54
50
CryptoObjects.EphimeralKey = new DKG();
55
51
CryptoObjects.EphimeralKey_next = new DKG();
@@ -665,9 +661,9 @@ void Sign(APDU apdu) {
665
661
// TODO: Check authorization to ask for signs
666
662
// TODO: Check for strictly increasing request counter
667
663
668
- Sign_counter .from_byte_array ((short ) 2 , (short ) 0 , m_cryptoOps .shortToByteArray ((short ) (apdubuf [ISO7816 .OFFSET_P1 ] & 0xff )), (short ) 0 );
664
+ m_cryptoOps . temp_sign_counter .from_byte_array ((short ) 2 , (short ) 0 , m_cryptoOps .shortToByteArray ((short ) (apdubuf [ISO7816 .OFFSET_P1 ] & 0xff )), (short ) 0 );
669
665
670
- dataLen = m_cryptoOps .Sign (m_quorums [0 ], Sign_counter , apdubuf , (short ) (ISO7816 .OFFSET_CDATA ), dataLen , apdubuf , (short ) 0 , apdubuf [ISO7816 .OFFSET_P2 ]);
666
+ dataLen = m_cryptoOps .Sign (m_quorums [0 ], m_cryptoOps . temp_sign_counter , apdubuf , (short ) (ISO7816 .OFFSET_CDATA ), dataLen , apdubuf , (short ) 0 , apdubuf [ISO7816 .OFFSET_P2 ]);
671
667
apdu .setOutgoingAndSend ((short ) 0 , dataLen ); //Send signature share
672
668
}
673
669
@@ -706,17 +702,6 @@ void GenerateRandomData(APDU apdu) {
706
702
apdu .setOutgoingAndSend ((short ) 0 , len );
707
703
}
708
704
709
-
710
- public final static byte [] xe_Bn_testInput1 = {
711
- (byte ) 0x03 , (byte ) 0xBD , (byte ) 0x28 , (byte ) 0x6B , (byte ) 0x6A , (byte ) 0x22 , (byte ) 0x1F , (byte ) 0x1B ,
712
- (byte ) 0xFC , (byte ) 0x08 , (byte ) 0xC6 , (byte ) 0xC5 , (byte ) 0xB0 , (byte ) 0x3F , (byte ) 0x0B , (byte ) 0xEA ,
713
- (byte ) 0x6C , (byte ) 0x38 , (byte ) 0xBE , (byte ) 0xBA , (byte ) 0xCF , (byte ) 0x20 , (byte ) 0x2A , (byte ) 0xAA ,
714
- (byte ) 0xDF , (byte ) 0xAC , (byte ) 0xA3 , (byte ) 0x70 , (byte ) 0x38 , (byte ) 0x32 , (byte ) 0xF8 , (byte ) 0xCC ,
715
- (byte ) 0xE0 , (byte ) 0xA8 , (byte ) 0x70 , (byte ) 0x88 , (byte ) 0xE9 , (byte ) 0x17 , (byte ) 0x21 , (byte ) 0xA3 ,
716
- (byte ) 0x4C , (byte ) 0x8D , (byte ) 0x0B , (byte ) 0x97 , (byte ) 0x11 , (byte ) 0x98 , (byte ) 0x02 , (byte ) 0x46 ,
717
- (byte ) 0x04 , (byte ) 0x56 , (byte ) 0x40 , (byte ) 0xA1 , (byte ) 0xAE , (byte ) 0x34 , (byte ) 0xC1 , (byte ) 0xFB ,
718
- (byte ) 0x7D , (byte ) 0xB8 , (byte ) 0x45 , (byte ) 0x28 , (byte ) 0xC6 , (byte ) 0x1B , (byte ) 0xC6 , (byte ) 0xD0 };
719
-
720
705
void TestNativeECC (APDU apdu , short dataLen ) {
721
706
/*
722
707
byte[] buff = apdu.getBuffer();
0 commit comments