Android Open Source - irma_android_cardproxy Protocol Command Deserializer






From Project

Back to project page irma_android_cardproxy.

License

The source code is released under:

GNU General Public License

If you think the Android project irma_android_cardproxy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.irmacard.androidcardproxy;
/*w  w  w.j  a v a2 s  .com*/
import java.lang.reflect.Type;

import net.sourceforge.scuba.smartcards.CommandAPDU;
import net.sourceforge.scuba.smartcards.ProtocolCommand;
import net.sourceforge.scuba.util.Hex;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

/**
 * Helper class to deserialize a ProtocolResponse from json
 *
 */
public class ProtocolCommandDeserializer implements JsonDeserializer<ProtocolCommand> {
  @Override
  public ProtocolCommand deserialize(JsonElement json, Type typeOfT,
      JsonDeserializationContext context) throws JsonParseException {
    return new ProtocolCommand(
        json.getAsJsonObject().get("key").getAsString(), "",
        new CommandAPDU(Hex.hexStringToBytes(json.getAsJsonObject().get("command").getAsString())));
  }
}




Java Source Code List

org.irmacard.androidcardproxy.ConfirmationDialogFragment.java
org.irmacard.androidcardproxy.MainActivity.java
org.irmacard.androidcardproxy.ProtocolCommandDeserializer.java
org.irmacard.androidcardproxy.ProtocolResponseSerializer.java
org.irmacard.androidcardproxy.messages.EventArguments.java
org.irmacard.androidcardproxy.messages.PinResultArguments.java
org.irmacard.androidcardproxy.messages.ReaderMessageArguments.java
org.irmacard.androidcardproxy.messages.ReaderMessageDeserializer.java
org.irmacard.androidcardproxy.messages.ReaderMessage.java
org.irmacard.androidcardproxy.messages.ResponseArguments.java
org.irmacard.androidcardproxy.messages.SelectAppletArguments.java
org.irmacard.androidcardproxy.messages.TransmitCommandSetArguments.java