CoseKey
Turns a COSE_Key (RFC 8152) into a PEM public key the rest of the world can verify against. An authenticator hands its public key inside the attestation as a COSE map, but {@see \openssl_verify()} wants a PEM. This bridges the two for ES256 (EC2 / P-256) — the one algorithm the passkey path speaks for now (greenhouse decisions/0123). It builds the uncompressed EC point (0x04 ‖ x ‖ y) and wraps it in the fixed ASN.1 SubjectPublicKeyInfo for prime256v1. A COSE key of any other type is refused, not guessed.
CoseKey::es256ToPem()
public static function es256ToPem(array $cose): stringConvert an ES256 (EC2/P-256) COSE key map into a PEM public key.
Parameters
| Name | Type | Description |
|---|---|---|
| $cose | array<(int | string), mixed> | the decoded COSE_Key map (integer labels) |
Throws
\RuntimeException when the key is not an ES256 P-256 key, or a coordinate is malformed