Interface SmartCardConnection

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, YubiKeyConnection

    public interface SmartCardConnection
    extends YubiKeyConnection
    A connection capable of sending APDUs and receiving their responses.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Transport getTransport()
      Checks what transport the connection is using (USB or NFC).
      boolean isExtendedLengthApduSupported()
      Standard APDUs have a 1-byte length field, allowing a maximum of 255 payload bytes, which results in a maximum APDU length of 261 bytes.
      byte[] sendAndReceive​(byte[] apdu)
      Sends a command APDU to the YubiKey, and reads a response.
      • Methods inherited from interface java.io.Closeable

        close
    • Method Detail

      • sendAndReceive

        byte[] sendAndReceive​(byte[] apdu)
                       throws java.io.IOException
        Sends a command APDU to the YubiKey, and reads a response.
        Parameters:
        apdu - The binary APDU data to be sent.
        Returns:
        The response back from the YubiKey.
        Throws:
        java.io.IOException - in case of communication error
      • getTransport

        Transport getTransport()
        Checks what transport the connection is using (USB or NFC).
        Returns:
        the physical transport used for the connection.
      • isExtendedLengthApduSupported

        boolean isExtendedLengthApduSupported()
        Standard APDUs have a 1-byte length field, allowing a maximum of 255 payload bytes, which results in a maximum APDU length of 261 bytes. Extended length APDUs have a 3-byte length field, allowing 65535 payload bytes.
        Returns:
        true if this connection object supports Extended length APDUs.