Commit 0cc5305c authored by Josh Ji's avatar Josh Ji

rename getHMAC() -> generateHMAC()

parent 603090fa
...@@ -84,7 +84,7 @@ public class IDSecret { ...@@ -84,7 +84,7 @@ public class IDSecret {
/** /**
* AES(aesRawKey, SHA256(IDx||Cx)) * AES(aesRawKey, SHA256(IDx||Cx))
*/ */
public void getHMAC(byte[] outputBuffer, short outputOffset){ public void generateHMAC(byte[] outputBuffer, short outputOffset){
Util.arrayCopy(IDx.str, (short)0, scratch, (short)0, (short)IDx.str.length); Util.arrayCopy(IDx.str, (short)0, scratch, (short)0, (short)IDx.str.length);
Util.arrayCopy(Cx, (short)0, scratch, (short)IDx.str.length, (short)Cx.length); Util.arrayCopy(Cx, (short)0, scratch, (short)IDx.str.length, (short)Cx.length);
short scratchLength = (short)(IDx.str.length + Cx.length); short scratchLength = (short)(IDx.str.length + Cx.length);
...@@ -152,10 +152,14 @@ public class IDSecret { ...@@ -152,10 +152,14 @@ public class IDSecret {
*/ */
public short dump(byte[] apduBuffer, byte[] dataBuffer, CBOREncoder encoder){ public short dump(byte[] apduBuffer, byte[] dataBuffer, CBOREncoder encoder){
encoder.init(dataBuffer, (short)0, (short)1200); encoder.init(dataBuffer, (short)0, (short)1200);
encoder.startMap((short)1); encoder.startMap((short)2);
encoder.encodeTextString(Utf8Strings.UTF8_TEMP, (short)0, (short)Utf8Strings.UTF8_TEMP.length); // encoder.encodeTextString(Utf8Strings.UTF8_TEMP, (short)0, (short)Utf8Strings.UTF8_TEMP.length);
encoder.encodeByteString(tempBuffer, (short)0, (short)tempBuffer.length); // encoder.encodeByteString(tempBuffer, (short)0, (short)tempBuffer.length);
encoder.encodeTextString(Utf8Strings.UTF8_HMAC, (short)0, (short)Utf8Strings.UTF8_HMAC.length);
encoder.encodeByteString(hmac, (short)0, (short)hmac.length);
encoder.encodeTextString(Utf8Strings.UTF8_ENCRYPTED_CX, (short)0, (short)Utf8Strings.UTF8_ENCRYPTED_CX.length);
encoder.encodeByteString(encryptedCx, (short)0, (short)encryptedCx.length);
return encoder.getCurrentOffset(); return encoder.getCurrentOffset();
} }
......
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