Commit 803cd23e authored by Josh Ji's avatar Josh Ji

plusOne()

parent 617ba2a4
...@@ -160,6 +160,27 @@ public class IDSecret { ...@@ -160,6 +160,27 @@ public class IDSecret {
return encoder.getCurrentOffset(); return encoder.getCurrentOffset();
} }
/**
* plus one to an unsigned integer byte array
* @param input unsigned integer
*/
public void plusOne(byte[] input){
short i = (short)(input.length-1);
byte bitFlag = (byte)0x01;
while(i>=0){
input[i]^=bitFlag;
if((input[i]&bitFlag)==bitFlag)
break;
else{
bitFlag <<= 1;
if(bitFlag==0){
bitFlag=(byte)0x01;
i--;
}
}
}
}
private void testSharedObjects(byte[] apduBuffer){ private void testSharedObjects(byte[] apduBuffer){
byte[] aid = new byte[]{(byte)0xa0,(byte)0x00,(byte)0x00,(byte)0x02,(byte)0x47,(byte)0x10,(byte)0x01}; byte[] aid = new byte[]{(byte)0xa0,(byte)0x00,(byte)0x00,(byte)0x02,(byte)0x47,(byte)0x10,(byte)0x01};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment