SecureChannel
internal final class SecureChannel
Represents a secure communication channel with cryptographic parameters.
This class defines a secure communication channel with encryption keys (KSenc, KSmac)
and a Send Sequence Counter (SSC) for secure messaging during a session. The SSC is an unsigned integer
and its bit size matches the block size of the block cipher used for secure messaging,
which is 64 bits for 3DES
and 128 bits for AES.
-
The encryption key for data confidentiality.
Declaration
Swift
private(set) var KSenc: [UInt8] { get }
-
The key for message authentication.
Declaration
Swift
private(set) var KSmac: [UInt8] { get }
-
The Send Sequence Counter (SSC) for secure messaging.
The SSC is an unsigned integer and its bit size matches the block size of the block cipher used for secure messaging. It should be incremented before generating a command or response APDU. For the first command, the SSC is incremented from the starting value
x
tox+1
, and for the first response, it becomesx+2
.Declaration
Swift
private(set) var ssc: [UInt8] { get }
-
Initializes a secure channel with the provided encryption keys and SSC.
Parameters
KSenc
The encryption key for data confidentiality.
KSmac
The key for message authentication.
ssc
The Send Sequence Counter (SSC) for secure messaging.
-
Increment the Send Sequence Counter (SSC).
The SSC should be incremented before generating a command or response APDU. For the first command, the value of SSC is increased from the starting value
x
tox+1
. For the first response, it becomesx+2
.Declaration
Swift
internal func incrementSSC()