COSEKey
About 1 min
COSEKey
class COSEKeyConstants
int
public const int = nullint
public const int = nullint
public const int = nullarray
public const array = nullint
private const int = nullint
private const int = nullint
private const int = nullint
private const int = nullProperties
algorithm
public readonly int $algorithmType: int
pem
public readonly string $pemType: string
cose
public readonly string $coseType: string
Methods
__construct
private __construct(int $algorithm, string $pem, string $cose): voidParameters
| Parameter | Type | Description |
|---|---|---|
$algorithm | int | |
$pem | string | |
$cose | string |
fromCOSE
Parses a COSE key from its CBOR encoding.
public fromCOSE(string $cose): selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$cose | string |
fromMap
Builds a key from an already decoded COSE map.
public fromMap(array $map, string $cose): selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$map | array | the decoded map |
$cose | string | the map's original CBOR bytes, kept for storage |
verify
Verifies a signature made with this key's private half.
public verify(string $data, string $signature): boolReturns: bool
ES256 signatures are ASN.1 DER encoded, as WebAuthn specifies; EdDSA signatures are the raw 64 bytes; RS256 signatures are PKCS#1 v1.5.
Parameters
| Parameter | Type | Description |
|---|---|---|
$data | string | |
$signature | string |
ec2
private ec2(array $map, mixed $kty): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$map | array | |
$kty | mixed |
okp
private okp(array $map, mixed $kty): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$map | array | |
$kty | mixed |
rsa
private rsa(array $map, mixed $kty): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$map | array | |
$kty | mixed |
coordinate
private coordinate(array $map, int $label, int $length): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$map | array | |
$label | int | |
$length | int |
sequence
private sequence(string $content): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$content | string |
oid
private oid(string $hex): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$hex | string |
bitString
private bitString(string $bytes): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$bytes | string |
integer
A positive DER INTEGER from big-endian bytes.
private integer(string $bytes): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$bytes | string |
length
private length(int $length): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$length | int |
clearOpenSSLErrors
Drains OpenSSL's error queue, so a failure here doesn't show up in an unrelated openssl_error_string() call.
private clearOpenSSLErrors(): voidReturns: void
Generated by Hazaar API Doc Generator on Wed, 28 Oct 2026 08:43:30 +0000