Skip to content

HTTPSig

  • Full name: \Zotlabs\Web\HTTPSig

See Also:

  • https://tools.ietf.org/html/draft-cavage-http-signatures-10 -

Methods

generate_digest_header

public static generate_digest_header(string $body, string $alg = 'sha256'): string
  • This method is static.

Parameters:

Parameter Type Description
$body string The value to create the digest for
$alg string hash algorithm (one of 'sha256','sha512')

Return Value:

The generated digest header string for $body

See Also:

  • https://tools.ietf.org/html/rfc5843 -

find_headers

public static find_headers(mixed $data, mixed& $body): mixed
  • This method is static.

Parameters:

Parameter Type Description
$data mixed
$body mixed

verify

public static verify(mixed $data, mixed $key = '', mixed $keytype = ''): mixed
  • This method is static.

Parameters:

Parameter Type Description
$data mixed
$key mixed
$keytype mixed

get_key

public static get_key(mixed $key, mixed $keytype, mixed $id, mixed $force = false): mixed
  • This method is static.

Parameters:

Parameter Type Description
$key mixed
$keytype mixed
$id mixed
$force mixed

convertKey

public static convertKey(mixed $key): mixed
  • This method is static.

Parameters:

Parameter Type Description
$key mixed

get_activitystreams_key

public static get_activitystreams_key(string $id, bool $force = false, mixed $delete = false): bool|array
  • This method is static.

Parameters:

Parameter Type Description
$id string
$force bool (optional, default false)
$delete mixed

Return Value:

false if no pub key found, otherwise return an array with the pub key


get_webfinger_key

public static get_webfinger_key(string $id, bool $force = false): bool|array
  • This method is static.

Parameters:

Parameter Type Description
$id string
$force bool (optional, default false)

Return Value:

false if no pub key found, otherwise return an array with the pub key


get_zotfinger_key

public static get_zotfinger_key(string $id, bool $force = false): bool|array
  • This method is static.

Parameters:

Parameter Type Description
$id string
$force bool (optional, default false)

Return Value:

false if no pub key found, otherwise return an array with the public key


create_sig

public static create_sig(array $head, string $prvkey, string $keyid = EMPTY_STR, bool $auth = false, string $alg = 'sha256', array $encryption = false): array
  • This method is static.

Parameters:

Parameter Type Description
$head array
$prvkey string
$keyid string (optional, default '')
$auth bool (optional, default false)
$alg string (optional, default 'sha256')
$encryption array [ 'key', 'algorithm' ] or false

set_headers

public static set_headers(array $headers): void
  • This method is static.

Parameters:

Parameter Type Description
$headers array

sign

public static sign(array $head, string $prvkey, string $alg = 'sha256'): array
  • This method is static.

Parameters:

Parameter Type Description
$head array
$prvkey string
$alg string (optional) default 'sha256'

parse_sigheader

public static parse_sigheader(string $header): array
  • This method is static.

Parameters:

Parameter Type Description
$header string

Return Value:

associate array with - \e string \b keyID - \e string \b algorithm - \e array \b headers - \e string \b signature


decrypt_sigheader

public static decrypt_sigheader(string $header, string $prvkey = null): array|string
  • This method is static.

Parameters:

Parameter Type Description
$header string
$prvkey string (optional), if not set use site private key

Return Value:

associative array, empty string if failue - \e string \b iv - \e string \b key - \e string \b alg - \e string \b data



Automatically generated on 2025-03-19