Android Open Source - irma_android_cardproxy Protocol Response Serializer






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;
//from   w w w .j  a v a 2s  .c om
import java.lang.reflect.Type;

import net.sourceforge.scuba.smartcards.ProtocolResponse;
import net.sourceforge.scuba.util.Hex;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

/**
 * Helper class to serialize ProtocolResponse to JSON.
 *
 */
public class ProtocolResponseSerializer implements JsonSerializer<ProtocolResponse> {
  @Override
  public JsonElement serialize(ProtocolResponse src, Type typeOfSrc,
      JsonSerializationContext context) {
    JsonObject obj = new JsonObject();
    obj.addProperty("key", src.getKey());
    obj.addProperty("apdu", Hex.bytesToHexString(src.getAPDU().getBytes()));
    return obj;
  }
}




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