iOS HMDeviceCertificate

Device Certificate is used to recognise or initialise an HMKit enabled device.

Initialising

Initialises a device certificate object from binary

Declaration

init?<C>(binary: C) where C : Collection, C.Element == UInt8

Parameters

binary

(UInt8 Collection) binary representation of Device Certificate

Returns

HMDeviceCertificate

Example

import HMKit

let bytes: [UInt8] = [0x01, 0x02, 0x03...0xA0, 0xB1, 0xC2]
let certificate: HMDeviceCertificate? = HMDeviceCertificate(binary: bytes)

Initialises a device certificate object from a base64 encoded string

Declaration

convenience init?(base64Encoded string: String)

Parameters

base64Encoded

(String) Base64 encoded string representation of Device Certificate

Returns

HMDeviceCertificate

Read More

Example

import HMKit

let str: String = "ASPx9P5Dd1Lu8y+fOjmmyR0...swj3OEzMkdfGFh5uUWdZ0Q2k="
let certificate: HMDeviceCertificate? = HMDeviceCertificate(base64Encoded: str)

Initialises a device certificate object with its required values

Declaration

convenience init?<C>(appIdentifier: C, issuer: C, publicKey: C, serial: C, signature: C, version: Version) where C : Collection, C.Element == UInt8

Parameters

appIdentifier

(UInt8 Collection) identifier of the application (not the one in .plist)

issuer

(UInt8 Collection) issuer identifier

publicKey

(UInt8 Collection) device's public key

serial

(UInt8 Collection) device's serial number

signature

(UInt8 Collection) signature of the certificate

version

(Version) of the certificate (may contain extra values)

Returns

HMDeviceCertificate

Example

import HMKit

let appID: [UInt8] = [0x11, 0x22...0x88, 0x99]
let issuer: [UInt8] = [0x12, 0x34, 0xDE, 0xF0]
let publicKey: [UInt8] = [0xAA, 0xBB...0x11, 0x22]
let serial: [UInt8] = [0xFE, 0xFF...0x01, 0xAA]
let signature: [UInt8] = [0x09, 0x87..0xAB, 0x1B]

let certificate: HMDeviceCertificate? = HMDeviceCertificate(appIdentifier: appID, issuer: issuer, publicKey: publicKey, serial: serial, signature: signature, version: .basic)

Properties

.bytes

Declaration

let bytes: [UInt8]

.version

Declaration

let version: Version

Read More

.appIdentifier

Declaration

let appIdentifier: [UInt8]

.issuer

Declaration

let issuer: [UInt8]

.publicKey

Declaration

let publicKey: [UInt8]

.serial

Declaration

let serial: [UInt8]

Conforming

Codable

Declaration

protocol Codable = Decodable & Encodable

Discussion

A type that can convert itself into and out of an external representation.

Read More

Equatable

Declaration

protocol Equatable

Discussion

A type that can be compared for value equality.

Read More

HMSigned

Declaration

protocol HMSigned

Discussion

A type that is signed with a signature and can be verified.

Read More