//kotlin-sdk/fr.gasmartbuilding.gasmartaccessreadersdk/LockReconUtils
LockReconUtils
[androidJvm]\ object LockReconUtils
Utility singleton for the GASmartAccessReaderSDK's lock mechanism. LockReconUtils
handles:
- ECC key management: Load, generate, and store key pairs.
- Data validation & transformation: Process and validate data for the lock.
- Cryptographic operations: Random number generation, ECDSA signing, and verification.
- Permissions check: Ensure necessary permissions for Bluetooth
- Frame processing: Delegate handling of incoming frames based on type.
Properties
Name | Summary |
---|---|
respError | [androidJvm] const val respError: Int = 96 |
respSuccess | [androidJvm] const val respSuccess: Int = 144 |
Functions
Name | Summary |
---|---|
byteArrayToInt | [androidJvm] fun byteArrayToInt(bytes: ByteArray): Int Convert byteArray to int |
checkHardware | [androidJvm] fun checkHardware(context: Context): HardwareState Checks and logs the status of necessary permissions including Bluetooth |
checkSignedChallengeSar | [androidJvm] fun checkSignedChallengeSar(rnd1: ByteArray, rawSignSar: ByteArray, sarPublicKeyByteArray: ByteArray): Boolean Verifies the signed challenge received from the SAR. |
extractData | [androidJvm] fun extractData(frameData: ByteArray): ByteArray Extract the data envelop form the frame byteArray received |
generateTRNG | [androidJvm] fun generateTRNG(length: Int): ByteArray This method generates true random numbers, compliant with NIST SP800-90. |
getRequiredPermissions | [androidJvm] fun getRequiredPermissions(): Array<String> |
handleLockReceivedFrame | [androidJvm] fun handleLockReceivedFrame(frameProcessor: FrameProcessor, data: ByteArray, identifier: String?): ByteArray Processes and responds to frames received from the lock. |
hasRequiredRuntimePermissions | [androidJvm] fun hasRequiredRuntimePermissions(context: Context): Boolean |
intToByteArray | [androidJvm] fun intToByteArray(integer: Int): ByteArray Convert int to byteArray |
isDataLengthValid | [androidJvm] fun isDataLengthValid(reqDataLen: Int, frameData: ByteArray): Boolean Check the data length provided in the frame 2 octets are removed, standing for frameKey and dataLen |
loadGenerateAppKeys | [androidJvm] fun loadGenerateAppKeys(): KeyPair? Generates an ECC NIST secp256r1 key pair and securely stores it in the Android KeyStore. |
setLockResponseFrame | [androidJvm] fun setLockResponseFrame(frameKey: FrameKey, data: ByteArray?): ByteArray Set the lock response frame. |
signBadgeId | [androidJvm] fun signBadgeId(keyPair: KeyPair, badgeId: Int): ByteArray Signs a given badge ID using the application's private key. |
signChallenge | [androidJvm] fun signChallenge(keyPair: KeyPair, byteArray: ByteArray): ByteArray Signs a given challenge using the application's private key. |