Commit eeed0b34 authored by Josh Ji's avatar Josh Ji

file encodings, remove unused memory claim

parent 7d4f5d78
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java/com/josh/vku2f/CTAP2.java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/java/com/josh/vku2f/CTAP2.java" charset="x-windows-950" />
<file url="file://$PROJECT_DIR$/src/main/java/com/josh/vku2f/IDSecret.java" charset="US-ASCII" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -39,12 +39,6 @@ public class AuthenticatorMakeCredential { ...@@ -39,12 +39,6 @@ public class AuthenticatorMakeCredential {
* @ param vars a short array to store variables in * @ param vars a short array to store variables in
*/ */
public AuthenticatorMakeCredential(CBORDecoder decoder) throws UserException { public AuthenticatorMakeCredential(CBORDecoder decoder) throws UserException {
short[] vars;
try {
vars = JCSystem.makeTransientShortArray((short) 8, JCSystem.CLEAR_ON_RESET);
} catch (Exception e) {
vars = new short[8];
}
// Start reading, we should get a map // Start reading, we should get a map
byte[] scratch1; byte[] scratch1;
try { try {
......
...@@ -113,9 +113,9 @@ public class CTAP2 extends Applet implements ExtendedLength { ...@@ -113,9 +113,9 @@ public class CTAP2 extends Applet implements ExtendedLength {
// 1210 bytes of a transient buffer for read-in and out // 1210 bytes of a transient buffer for read-in and out
// We advertise 1200 bytes supported, but 10 bytes for protocol nonsense // We advertise 1200 bytes supported, but 10 bytes for protocol nonsense
try { try {
dataBuffer = JCSystem.makeTransientByteArray((short) 1510, JCSystem.CLEAR_ON_DESELECT); dataBuffer = JCSystem.makeTransientByteArray((short) 1210, JCSystem.CLEAR_ON_DESELECT);
} catch (Exception e) { } catch (Exception e) {
dataBuffer = new byte[1510]; dataBuffer = new byte[1210];
} }
try { try {
scratch = JCSystem.makeTransientByteArray((short) 512, JCSystem.CLEAR_ON_DESELECT); scratch = JCSystem.makeTransientByteArray((short) 512, JCSystem.CLEAR_ON_DESELECT);
...@@ -590,7 +590,7 @@ public class CTAP2 extends Applet implements ExtendedLength { ...@@ -590,7 +590,7 @@ public class CTAP2 extends Applet implements ExtendedLength {
// Read the credential details in // Read the credential details in
// Just note down where this starts for future ref // Just note down where this starts for future ref
tempVars[0] += tempCredential.getAttestedData(dataBuffer, tempVars[0]); tempVars[0] += tempCredential.getAttestedData(dataBuffer, tempVars[0]);
// extensions 這才是fido指定extension 要放的位置a // extensions 這才是fido指定extension 要放的位置a
// Util.arrayCopy(extensionBuffer, (short)0, dataBuffer, tempVars[0], extensionLength); // Util.arrayCopy(extensionBuffer, (short)0, dataBuffer, tempVars[0], extensionLength);
// Attestation Statement : 0x03 // Attestation Statement : 0x03
...@@ -623,7 +623,7 @@ public class CTAP2 extends Applet implements ExtendedLength { ...@@ -623,7 +623,7 @@ public class CTAP2 extends Applet implements ExtendedLength {
cborEncoder.startArray((short) 1); cborEncoder.startArray((short) 1);
cborEncoder.encodeByteString(attestationKeyPair.x509cert, (short) 0, attestationKeyPair.x509len); cborEncoder.encodeByteString(attestationKeyPair.x509cert, (short) 0, attestationKeyPair.x509len);
if(authenticatorMakeCredential.opCode == OpCode.GET_IDENTITY_CREDENTIAL){ if(authenticatorMakeCredential.opCode == OpCode.GET_IDENTITY_CREDENTIAL){
// add extension label 這邊是暫時找個地方放 // add extension label 這邊是暫時找個地方放
cborEncoder.encodeTextString(Utf8Strings.UTF8_EXTENSIONS, (short) 0, (short) Utf8Strings.UTF8_EXTENSIONS.length); cborEncoder.encodeTextString(Utf8Strings.UTF8_EXTENSIONS, (short) 0, (short) Utf8Strings.UTF8_EXTENSIONS.length);
// add extension element // add extension element
cborEncoder.startArray((short) 2); cborEncoder.startArray((short) 2);
......
...@@ -24,7 +24,6 @@ public class ClientPINCommand { ...@@ -24,7 +24,6 @@ public class ClientPINCommand {
private byte[] pinHashEnc = new byte[16]; // byte string, aes256 private byte[] pinHashEnc = new byte[16]; // byte string, aes256
private byte permissions; // unsigned int private byte permissions; // unsigned int
private byte[] rpId = new byte[64]; // text string private byte[] rpId = new byte[64]; // text string
byte[] scratch = JCSystem.makeTransientByteArray((short)64, JCSystem.CLEAR_ON_RESET);
public void decodeCommand(CBORDecoder cborDecoder) throws UserException { public void decodeCommand(CBORDecoder cborDecoder) throws UserException {
short commandLength = cborDecoder.readMajorType(CBORBase.TYPE_MAP); short commandLength = cborDecoder.readMajorType(CBORBase.TYPE_MAP);
......
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