Android AccessCertificate

Access Certificate is used to recognise and authorise two HM SDK devices.

Initialising

INITIALISE THE ACCESS CERTIFICATE WITH ALL ITS PROPERTIES EXCEPT CERTIFICATE AUTHORITY SIGNATURE

Declaration

public AccessCertificate(
    Issuer issuer, 
    DeviceSerial providingSerial, 
    DeviceSerial gainerSerial, 
    PublicKey gainingPublicKey, 
    HMCalendar startDate, 
    HMCalendar endDate, 
    Permissions permissions)

Parameters

issuer

The 4-byte identifier of the issuer of this certificate. Set to null if v0 certificate.

providingSerial

9-byte serial number of the device providing access to itself.

gainerSerial

9-byte serial number of the device that's gaining access.

gainingPublicKey

64-byte public key of the device gaining access.

startDate

The start time (and date) of the certificate.

endDate

The expiration time of the certificate.

permissions

Permissions supplied with the certificate (up to 16 bytes).

Returns

AccessCertificate

Example

AccessCertificate certificate = new AccessCertificate(
    new Issuer("746D6373"),
    new DeviceSerial("5E...DDA5"),
    new DeviceSerial("04...704A"),
    new PublicKey("E0...CB9F"),
    new HMCalendar("12...0C0D"),
    new HMCalendar("1B...0F11"),
    new Permissions("10...000"))
    );

INITIALISE THE ACCESS CERTIFICATE WITH BYTES

Declaration

AccessCertificate(Bytes bytes);

Parameters

bytes

The bytes making up the certificate (at least 93 bytes are expected).

Returns

AccessCertificate

Example

Bytes bytes = new Bytes("0103...000B");
AccessCertificate certificate = new AccessCertificate(bytes);

Properties

getIssuer()

Declaration

public Issuer getIssuer();

Discussion

The certificates issuer

getProviderSerial()

Declaration

public DeviceSerial getProviderSerial();

Discussion

The serial number of the device that's providing access

getGainerSerial()

Declaration

public DeviceSerial getGainerSerial();

Discussion

The serial number of the device that's gaining access

getGainerPublicKey()

Declaration

public PublicKey getGainerPublicKey();

Discussion

The public key of the device that's gaining access

getStartDate()

Declaration

public HMCalendar getStartDate();

Discussion

The certificate validity start date

getEndDate()

Declaration

public HMCalendar getEndDate();

Discussion

The certificate validity end date

getPermissions()

Declaration

public Permissions getPermissions();

Discussion

The permissions given for the certificate, up to 16 bytes and can both contain arbitrary data as well as permission bytes that correspond to the auto api

Inherited properties

getSignature()

Declaration

Signature getSignature();

Discussion

The certificate authority's signature for the certificate, 64 bytes.

setSignature()

Declaration

setSignature(Signature signature)

Parameters

signature

The new signature

Example

certificate.setSignature(new Signature("DDEE...00")

getCertificateData()

Declaration

Bytes getCertificateData();

Discussion

The certificate data in binary, excluding the signature.

Helpers

isExpired

Declaration

boolean isExpired()

Returns

whether certificate is expired

isNotValidYet

Declaration

boolean isNotValidYet()

Returns

whether certificate is not valid yet, and will be in the future