abstract class ResultData


An object that contains the result of retrieving data from a credential. This is used to return data requested from a IdentityCredential.

Summary

Constants

const Int

Requested entry wasn't in the request message.

const Int

Requested entry was not requested.

const Int

The requested entry was not retrieved because it was configured without any access control profile.

const Int

Requested entry does not exist.

const Int

Value was successfully retrieved.

const Int

The requested entry was not retrieved because reader authentication wasn't performed.

const Int

The requested entry was not retrieved because user authentication wasn't performed.

Public functions

abstract ByteArray<Byte>

Returns a CBOR structure containing the retrieved data.

abstract ByteArray<Byte>?

Returns a digital signature over the DeviceAuthenticationBytes CBOR specified in getAuthenticatedData, to prove to the reader that the data is from a trusted credential.

abstract ByteArray<Byte>?
getEntry(namespaceName: String, name: String)

Gets the raw CBOR data for the value of an entry.

Boolean
getEntryBoolean(namespaceName: String, name: String)

Gets the value of an entry.

ByteArray<Byte>?
getEntryBytestring(namespaceName: String, name: String)

Gets the value of an entry.

Calendar?
getEntryCalendar(namespaceName: String, name: String)

Gets the value of an entry.

Long
getEntryInteger(namespaceName: String, name: String)

Gets the value of an entry.

abstract (Mutable)Collection<String!>?
getEntryNames(namespaceName: String)

Get the names of all entries.

String?
getEntryString(namespaceName: String, name: String)

Gets the value of an entry.

abstract ByteArray<Byte>?

Returns a message authentication code over the DeviceAuthenticationBytes CBOR specified in getAuthenticatedData, to prove to the reader that the data is from a trusted credential.

abstract (Mutable)Collection<String!>

Gets the names of namespaces with retrieved entries.

abstract (Mutable)Collection<String!>?

Get the names of all entries that was successfully retrieved.

abstract ByteArray<Byte>

Returns the static authentication data associated with the dynamic authentication key used to sign or MAC the data returned by getAuthenticatedData.

abstract Int
getStatus(namespaceName: String, name: String)

Gets the status of an entry.

Constants

STATUS_NOT_IN_REQUEST_MESSAGE

Added in 1.0.0-alpha04
const val STATUS_NOT_IN_REQUEST_MESSAGE = 3: Int

Requested entry wasn't in the request message.

STATUS_NOT_REQUESTED

Added in 1.0.0-alpha04
const val STATUS_NOT_REQUESTED = 2: Int

Requested entry was not requested.

STATUS_NO_ACCESS_CONTROL_PROFILES

Added in 1.0.0-alpha04
const val STATUS_NO_ACCESS_CONTROL_PROFILES = 6: Int

The requested entry was not retrieved because it was configured without any access control profile.

STATUS_NO_SUCH_ENTRY

Added in 1.0.0-alpha04
const val STATUS_NO_SUCH_ENTRY = 1: Int

Requested entry does not exist.

STATUS_OK

Added in 1.0.0-alpha04
const val STATUS_OK = 0: Int

Value was successfully retrieved.

STATUS_READER_AUTHENTICATION_FAILED

Added in 1.0.0-alpha04
const val STATUS_READER_AUTHENTICATION_FAILED = 5: Int

The requested entry was not retrieved because reader authentication wasn't performed.

STATUS_USER_AUTHENTICATION_FAILED

Added in 1.0.0-alpha04
const val STATUS_USER_AUTHENTICATION_FAILED = 4: Int

The requested entry was not retrieved because user authentication wasn't performed.

Public functions

getAuthenticatedData

Added in 1.0.0-alpha04
abstract fun getAuthenticatedData(): ByteArray<Byte>

Returns a CBOR structure containing the retrieved data.

This structure - along with the session transcript - may be cryptographically authenticated to prove to the reader that the data is from a trusted credential and getMessageAuthenticationCode can be used to get a MAC.

The CBOR structure which is cryptographically authenticated is the DeviceAuthenticationBytes structure according to the following CDDL schema:

  DeviceAuthentication = [
    "DeviceAuthentication",
    SessionTranscript,
    DocType,
    DeviceNameSpacesBytes
  ]

  DocType = tstr
  SessionTranscript = any
  DeviceNameSpacesBytes = #6.24(bstr .cbor DeviceNameSpaces)
  DeviceAuthenticationBytes = #6.24(bstr .cbor DeviceAuthentication)

where

  DeviceNameSpaces = {
    * NameSpace => DeviceSignedItems
  }

  DeviceSignedItems = {
    + DataItemName => DataItemValue
  }

  NameSpace = tstr
  DataItemName = tstr
  DataItemValue = any

The returned data is the binary encoding of the DeviceNameSpaces structure as defined above.

Returns
ByteArray<Byte>

The bytes of the DeviceNameSpaces CBOR structure.

getEcdsaSignature

Added in 1.0.0-alpha04
abstract fun getEcdsaSignature(): ByteArray<Byte>?

Returns a digital signature over the DeviceAuthenticationBytes CBOR specified in getAuthenticatedData, to prove to the reader that the data is from a trusted credential. The signature will be made with one of the provisioned dynamic authentication keys. At most one of getMessageAuthenticationCode or getEcdsaSignature is implemented.

Returns
ByteArray<Byte>?

null if not implemented, otherwise a COSE_Sign1 structure with the payload set to the data returned by getAuthenticatedData.

getEntry

Added in 1.0.0-alpha04
abstract fun getEntry(namespaceName: String, name: String): ByteArray<Byte>?

Gets the raw CBOR data for the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
ByteArray<Byte>?

the raw CBOR data or null if no entry with the given name exists.

getEntryBoolean

Added in 1.0.0-alpha04
fun getEntryBoolean(namespaceName: String, name: String): Boolean

Gets the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
Boolean

a boolean or false if no entry with the given name exists.

getEntryBytestring

Added in 1.0.0-alpha04
fun getEntryBytestring(namespaceName: String, name: String): ByteArray<Byte>?

Gets the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
ByteArray<Byte>?

a byte[] or null if no entry with the given name exists.

getEntryCalendar

Added in 1.0.0-alpha04
fun getEntryCalendar(namespaceName: String, name: String): Calendar?

Gets the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
Calendar?

a Calendar or null if no entry with the given name exists.

getEntryInteger

Added in 1.0.0-alpha04
fun getEntryInteger(namespaceName: String, name: String): Long

Gets the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
Long

a long or 0 if no entry with the given name exists.

getEntryNames

Added in 1.0.0-alpha04
abstract fun getEntryNames(namespaceName: String): (Mutable)Collection<String!>?

Get the names of all entries. This includes the name of entries that wasn't successfully retrieved.

Parameters
namespaceName: String

the namespace name to get entries for.

Returns
(Mutable)Collection<String!>?

A collection of names or null if there are no entries for the given namespace.

getEntryString

Added in 1.0.0-alpha04
fun getEntryString(namespaceName: String, name: String): String?

Gets the value of an entry. This should only be called on an entry for which the getStatus method returns STATUS_OK.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
String?

a String or null if no entry with the given name exists.

getMessageAuthenticationCode

Added in 1.0.0-alpha04
abstract fun getMessageAuthenticationCode(): ByteArray<Byte>?

Returns a message authentication code over the DeviceAuthenticationBytes CBOR specified in getAuthenticatedData, to prove to the reader that the data is from a trusted credential.

The MAC proves to the reader that the data is from a trusted credential. This code is produced by using the key agreement and key derivation function from the ciphersuite with the authentication private key and the reader ephemeral public key to compute a shared message authentication code (MAC) key, then using the MAC function from the ciphersuite to compute a MAC of the authenticated data. See section 9.2.3.5 of ISO/IEC 18013-5 for details of this operation.

If the sessionTranscript parameter passed to getEntries was null or the reader ephmeral public key was never set using setReaderEphemeralPublicKey, no message authencation code will be produced and this method will return null. At most one of getMessageAuthenticationCode or getEcdsaSignature is implemented.

Returns
ByteArray<Byte>?

A COSE_Mac0 structure with the message authentication code as described above or null if the conditions specified above are not met.

getNamespaces

Added in 1.0.0-alpha04
abstract fun getNamespaces(): (Mutable)Collection<String!>

Gets the names of namespaces with retrieved entries.

Returns
(Mutable)Collection<String!>

collection of name of namespaces containing retrieved entries. May be empty if no data was retrieved.

getRetrievedEntryNames

Added in 1.0.0-alpha04
abstract fun getRetrievedEntryNames(namespaceName: String): (Mutable)Collection<String!>?

Get the names of all entries that was successfully retrieved. This only return entries for which getStatus will return STATUS_OK.

Parameters
namespaceName: String

the namespace name to get entries for.

Returns
(Mutable)Collection<String!>?

A collection of names or null if there are no entries for the given namespace.

getStaticAuthenticationData

Added in 1.0.0-alpha04
abstract fun getStaticAuthenticationData(): ByteArray<Byte>

Returns the static authentication data associated with the dynamic authentication key used to sign or MAC the data returned by getAuthenticatedData.

Returns
ByteArray<Byte>

The static authentication data associated with dynamic authentication key used to MAC the data.

getStatus

Added in 1.0.0-alpha04
abstract fun getStatus(namespaceName: String, name: String): Int

Gets the status of an entry. This returns STATUS_OK if the value was retrieved, STATUS_NO_SUCH_ENTRY if the given entry wasn't retrieved, STATUS_NOT_REQUESTED if it wasn't requested, STATUS_NOT_IN_REQUEST_MESSAGE if the request message was set but the entry wasn't present in the request message, STATUS_USER_AUTHENTICATION_FAILED if the value wasn't retrieved because the necessary user authentication wasn't performed, STATUS_READER_AUTHENTICATION_FAILED if the supplied reader certificate chain didn't match the set of certificates the entry was provisioned with, or STATUS_NO_ACCESS_CONTROL_PROFILES if the entry was configured without any access control profiles.

Parameters
namespaceName: String

the namespace name of the entry.

name: String

the name of the entry to get the value for.

Returns
Int

the status indicating whether the value was retrieved and if not, why.