Airship\Cabin\Bridge\Blueprint\ChannelUpdates::verifyMasterSignature PHP Method

verifyMasterSignature() protected method

Verify that this key update was signed by the master key for this supplier.
protected verifyMasterSignature ( array $supplierData, array $keyData, array $nodeData ) : boolean
$supplierData array
$keyData array
$nodeData array
return boolean
    protected function verifyMasterSignature(array $supplierData, array $keyData, array $nodeData) : bool
    {
        $masterData = \json_decode($nodeData['master'], true);
        if ($masterData === false) {
            return false;
        }
        foreach ($supplierData['signing_keys'] as $key) {
            if ($key['type'] !== 'master') {
                continue;
            }
            if (\hash_equals($keyData['public_key'], $masterData['public_key'])) {
                $publicKey = new SignaturePublicKey(\Sodium\hex2bin($masterData['public_key']));
                $message = \json_encode($keyData);
                // If the signature is valid, we return true.
                return AsymmetricCrypto::verify($message, $publicKey, $masterData['signature']);
            }
        }
        // Fail closed.
        return false;
    }