Class ScDaemonNativeBridge

java.lang.Object
com.itemis.jscdlib.internal.NativeBase
com.itemis.jscdlib.internal.ScDaemonNativeBridge
All Implemented Interfaces:
AutoCloseable

public final class ScDaemonNativeBridge extends NativeBase implements AutoCloseable
ScDaemonNativeBridge relies on preview features of the Java platform:
Programs can only use ScDaemonNativeBridge when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  • Constructor Details

  • Method Details

    • assuanNew

      public long assuanNew(MemorySegmentPREVIEW p_ctx)
      Create a new assuan context with default arguments.
      Parameters:
      p_ctx - Pointer of pointer segment. Will hold the pointer to the created ctx upon successful return.
      Returns:
      gpg_error_t - 0 for success, error code else.
    • assuanRelease

      public void assuanRelease(MemorySegmentPREVIEW ctx)
      Release all resources associated with ctx.
      Parameters:
      ctx - Pointer to ctx created with
      invalid reference
      #assuanNew(MemoryAddress)
      .
    • assuanSocketConnect

      public long assuanSocketConnect(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW name, int server_pid, int flags)
      Connect to an assuan socket (to the scdaemon).
      Parameters:
      ctx - Pointer to ctx created with
      invalid reference
      #assuanNew(MemoryAddress)
      .
      name - Unix domain socket to connect to. May be a URI to a file.
      server_pid - Currently unused. Use ASSUAN_INVALID_PID (-1)
      flags - Undocumented. Use ASSUAN_SOCKET_CONNECT_FDPASSING (1)
      Returns:
      gpg_error_t - 0 for success, error code else.
    • assuanTransact

      public long assuanTransact(MemorySegmentPREVIEW ctx, MemorySegmentPREVIEW command, MemorySegmentPREVIEW data_cb, MemorySegmentPREVIEW data_cb_arg, MemorySegmentPREVIEW inquire_cb, MemorySegmentPREVIEW inquire_cb_arg, MemorySegmentPREVIEW status_cb, MemorySegmentPREVIEW status_cb_arg)

      Send a command to the smart card daemon (scdaemon).

      Use

      invalid reference
      CLinker#upcallStub(java.lang.invoke.MethodHandle, jdk.incubator.foreign.FunctionDescriptor)
      to provide proper callbacks.

      Required callback signatures are:

      • gpg_error_t (*data_cb)(void *, const void *, size_t)
      • gpg_error_t (*inquire_cb)(void*, const char *)
      • gpg_error_t (*status_cb)(void*, const char *)

      Parameters:
      ctx - Pointer to Assuan ctx
      command - Pointer to command string
      data_cb - Callback method for returned data.
      data_cb_arg - Will be passed to the callback along other things. May be
      invalid reference
      MemoryAddress#NULL
      .
      inquire_cb - Callback method if the daemon needs more information from the client.
      inquire_cb_arg - Will be passed to the callback along other things. May be
      invalid reference
      MemoryAddress#NULL
      .
      status_cb - Called for status lines returned from the daemon.
      status_cb_arg - Will be passed to the callback along other things. May be
      invalid reference
      MemoryAddress#NULL
      .
      Returns:
      gpg_error_t
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable