SpringCard SpringCore Library for .NET  20.04.16
High-level access to the SpringCore devices
SpringCard.SpringCore.Direct.CompanionDirectDevice Class Reference

Access to a SpringCore device through the Companion service. More...

Inheritance diagram for SpringCard.SpringCore.Direct.CompanionDirectDevice:
SpringCard.SpringCore.Direct.DirectDevice

Public Member Functions

 CompanionDirectDevice (string DeviceId)
 Instantiate a device through the service given its ID. More...
 
override bool Open ()
 Open a connection to the device. More...
 
override void Close ()
 Close the connection with the device. More...
 
override void Release ()
 Release all resources associated to the device. More...
 
override bool Active ()
 Is the connection open? More...
 
override bool Exchange (byte cla, byte cmd, byte[] send_data, out byte sta, out byte[] out_data, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
override bool Exchange (byte cla, byte[] send, out byte[] recv, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
- Public Member Functions inherited from SpringCard.SpringCore.Direct.DirectDevice
virtual void Dispose ()
 Dispose of the device object. More...
 
bool Exchange (byte cla, byte[] send, out byte[] recv)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (CLA cla, byte[] send, out byte[] recv, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (CLA cla, byte[] send, out byte[] recv)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (byte cla, byte[] send, ExchangeOptions options)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (byte cla, byte[] send)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (CLA cla, byte[] send, ExchangeOptions options)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (CLA cla, byte[] send)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data, out byte sta, out byte[] out_data, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data, out byte sta, out byte[] out_data)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (byte cla, byte cmd, byte[] send_data, ExchangeOptions options)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (byte cla, byte cmd, byte[] send_data)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data, ExchangeOptions options)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data)
 Send a command to the device (and wait for its response, but the response is discarded). More...
 
bool Exchange (byte cla, byte cmd, byte[] send_data, out byte[] recv_data, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (byte cla, byte cmd, byte[] send_data, out byte[] recv_data)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data, out byte[] recv_data, ExchangeOptions options)
 Send a command to the device (and wait for its response). More...
 
bool Exchange (CLA cla, byte cmd, byte[] send_data, out byte[] recv_data)
 Send a command to the device (and wait for its response). More...
 
bool Ping ()
 Ping the device to verify that the connection stays active. More...
 
virtual string GetVendorName ()
 Get the device's Vendor Name. More...
 
virtual string GetProductName ()
 Get the device's Product Name. More...
 
virtual string GetSerialNumber ()
 Get the device's Serial Number. More...
 
virtual string GetPnpId ()
 Get the device's Plug'N'Play ID. More...
 
virtual string GetVersion ()
 Get the device's Firmware Version. More...
 
virtual string GetRevision ()
 Get the device's Firmware Revision. More...
 
virtual string GetBuildUser ()
 Get the user that has built the device's Firmware. More...
 
virtual string GetBuildDateTime ()
 Get the date and time of building the device's Firmware. More...
 
virtual string GetFirmwareName ()
 Get the name of the device's Firmware. More...
 
virtual string GetUniqueId ()
 Get the device's Unique ID. More...
 
virtual string GetConfigurationId ()
 Get the GUID of the configuration. More...
 
virtual string GetHardwareReference ()
 Get the device's Hardware Reference. More...
 
virtual string GetHardwareCharacteristics ()
 Get the device's Hardware Characteristics. More...
 
virtual string GetOriginalVendorName ()
 Get the device's original Vendor Name. More...
 
virtual string GetOriginalProductName ()
 Get the device's original Product Name. More...
 
virtual string GetDetectedProductVariant ()
 Get the device's Product Variant. More...
 
bool AuthenticateAes (KeySelect keySelect, byte[] keyValue)
 Get authenticated onto the SpringCore device (https://docs.springcard.com/books/SpringCore/Host_interfaces/Logical/Direct_Protocol/Secure_Communication) More...
 
bool ChangeKeyAes (KeySelect keySelect, byte[] keyValue)
 Change a key (https://docs.springcard.com/books/SpringCore/Host_interfaces/Logical/Direct_Protocol/PROTOCOL_class/CHANGE_KEY) More...
 
bool ResetAuthentication ()
 Clear the authenticate state (forget the session keys) More...
 
bool AuthenticateFactory (string privateKeyFile=null)
 

Static Public Member Functions

static string ApiUrl ()
 Actual URL of the service. More...
 
static bool ServiceIsRunning ()
 Is the service running? More...
 
static List< string > GetDeviceList ()
 Retrieve the list of devices from the service. More...
 
- Static Public Member Functions inherited from SpringCard.SpringCore.Direct.DirectDevice
static List< string > GetList (ListMode listMode)
 List the available devices. More...
 
static DirectDevice CreateNoDevice ()
 Instantiate a dummy device (for test only). More...
 
static DirectDevice Create (string devicePath, BlockingCollection< DirectDevice.IncomingEvent > eventQueue=null)
 Instantiate a device, given a devicePath returned by GetList. More...
 
static DirectDevice Create (ListMode listMode, int deviceIndex, BlockingCollection< DirectDevice.IncomingEvent > eventQueue=null)
 Instantiate a device, given an (assumed) index in the list of devices. More...
 
static DirectDevice Create (List< string > devicePaths, int deviceIndex, BlockingCollection< DirectDevice.IncomingEvent > eventQueue=null)
 Instantiate a device, given an index and the list of devices. More...
 
static byte[] CreateFactoryChallengeResponse (string privateKeyFile, byte[] challenge)
 Create a signature for the challenge, using the specified private key file (.pem format) More...
 
static byte[] CreateFactoryChallengeResponse (byte[] challenge)
 Create a signature for the challenge, using the SpringCoreAuthenticateFactory.private.pem private key (if present in the execution path) More...
 
static byte[] CreateSignature (AsymmetricCipherKeyPair privateKey, byte[] message)
 Create a signature, using the SpringCoreAuthenticitySeal.private.pem private key (if present in the execution path) More...
 
static bool IsSealValid (string publicKeyFile, byte[] subject, byte[] seal)
 Verify that the device's seal is genuine, using the specified public key file (.pem format) More...
 
static bool IsSealValid (byte[] subject, byte[] seal)
 Verify that the device's seal is genuine, using the SpringCoreAuthenticitySeal.pem public key (if present in the execution path) More...
 
static byte[] CreateSeal (string privateKeyFile, byte[] subject)
 Create a seal for the device, using the specified private key file (.pem format) More...
 
static byte[] CreateSeal (byte[] subject)
 Create a seal for the device, using the SpringCoreAuthenticitySeal.private.pem private key (if present in the execution path) More...
 

Static Public Attributes

const string DefaultApiUrl = "http://127.0.0.1:3998"
 Default URL of the service. More...
 
static string UserApiUrl = null
 User-specified URL of the service. More...
 
static string DetectedApiUrl = null
 Actual URL where the service been successfully contacted. More...
 
const uint DefaultRequestTimeout = 60000
 Default timeout for the requests to the service. More...
 
- Static Public Attributes inherited from SpringCard.SpringCore.Direct.DirectDevice
static bool UseLogger = false
 Forward debug information to underlying logger library? More...
 
const uint DefaultDeviceTimeout = 60000
 Default timeout when communicating with the device. More...
 
const string AuthenticySealPublicPemFile = @"SpringCoreAuthenticitySeal.pem"
 Name of the public key file (.pem format) More...
 
const string AuthenticySealPrivatePemFile = @"SpringCoreAuthenticitySeal.private.pem"
 Name of the private key file (.pem format) - for factory only. More...
 

Additional Inherited Members

- Public Types inherited from SpringCard.SpringCore.Direct.DirectDevice
enum  ListMode {
  ListMode.None = 0x0000, ListMode.Companion = 0x0001, ListMode.UsbDirect = 0x0010, ListMode.BleDirect = 0x0020,
  ListMode.Direct = 0x00F0, ListMode.Pcsc = 0x0100, ListMode.PcscAll = 0x0300
}
 How to list the devices? More...
 
enum  CLA : byte {
  CLA.Protocol = 0x00, CLA.HCE = 0x57, CLA.Control = 0x58, CLA.AtCrypto = 0x59,
  CLA.NxpSam = 0x5A, CLA.RDR = 0x5B, CLA.I2C = 0x5C, CLA.DFU = 0x5D,
  CLA.Echo = 0x5E
}
 CLAsses uses for direct communication with a SpringCore device (https://docs.springcard.com/books/SpringCore/Host_interfaces/Logical/Direct_Protocol/List_of_CLAsses) More...
 
enum  KeySelect : byte { KeySelect.HostCommUserKey = 0, KeySelect.HostCommAdminKey = 1 }
 Authentication mode. More...
 
- Public Attributes inherited from SpringCard.SpringCore.Direct.DirectDevice
ControlI Control
 Control interface. More...
 
AtCryptoI AtCrypto
 Crypto Companion interface. More...
 
SamAvI SamAv
 Secure Element interface. More...
 
HCEI Hce
 HCE interface. More...
 
DFUI Dfu
 DFU interface. More...
 
- Protected Member Functions inherited from SpringCard.SpringCore.Direct.DirectDevice
void Prepare ()
 
- Protected Attributes inherited from SpringCard.SpringCore.Direct.DirectDevice
string deviceId
 
BlockingCollection< DirectDevice.IncomingEventeventQueue
 

Detailed Description

Access to a SpringCore device through the Companion service.

Constructor & Destructor Documentation

◆ CompanionDirectDevice()

SpringCard.SpringCore.Direct.CompanionDirectDevice.CompanionDirectDevice ( string  DeviceId)

Instantiate a device through the service given its ID.

Member Function Documentation

◆ Active()

override bool SpringCard.SpringCore.Direct.CompanionDirectDevice.Active ( )
virtual

Is the connection open?

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ ApiUrl()

static string SpringCard.SpringCore.Direct.CompanionDirectDevice.ApiUrl ( )
static

Actual URL of the service.

◆ Close()

override void SpringCard.SpringCore.Direct.CompanionDirectDevice.Close ( )
virtual

Close the connection with the device.

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ Exchange() [1/2]

override bool SpringCard.SpringCore.Direct.CompanionDirectDevice.Exchange ( byte  cla,
byte  cmd,
byte[]  send_data,
out byte  sta,
out byte[]  out_data,
ExchangeOptions  options 
)
virtual

Send a command to the device (and wait for its response).

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ Exchange() [2/2]

override bool SpringCard.SpringCore.Direct.CompanionDirectDevice.Exchange ( byte  cla,
byte[]  send,
out byte[]  recv,
ExchangeOptions  options 
)
virtual

Send a command to the device (and wait for its response).

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ GetDeviceList()

static List<string> SpringCard.SpringCore.Direct.CompanionDirectDevice.GetDeviceList ( )
static

Retrieve the list of devices from the service.

◆ Open()

override bool SpringCard.SpringCore.Direct.CompanionDirectDevice.Open ( )
virtual

Open a connection to the device.

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ Release()

override void SpringCard.SpringCore.Direct.CompanionDirectDevice.Release ( )
virtual

Release all resources associated to the device.

Implements SpringCard.SpringCore.Direct.DirectDevice.

◆ ServiceIsRunning()

static bool SpringCard.SpringCore.Direct.CompanionDirectDevice.ServiceIsRunning ( )
static

Is the service running?

Member Data Documentation

◆ DefaultApiUrl

const string SpringCard.SpringCore.Direct.CompanionDirectDevice.DefaultApiUrl = "http://127.0.0.1:3998"
static

Default URL of the service.

◆ DefaultRequestTimeout

const uint SpringCard.SpringCore.Direct.CompanionDirectDevice.DefaultRequestTimeout = 60000
static

Default timeout for the requests to the service.

◆ DetectedApiUrl

string SpringCard.SpringCore.Direct.CompanionDirectDevice.DetectedApiUrl = null
static

Actual URL where the service been successfully contacted.

◆ UserApiUrl

string SpringCard.SpringCore.Direct.CompanionDirectDevice.UserApiUrl = null
static

User-specified URL of the service.


The documentation for this class was generated from the following file: