setasign\SetaPDF2\Signer

PemHelper Helper class for en- and decoding of PEM encoded data.

File: /SetaPDF v2/Signer/PemHelper.php
Old class name (alias): \SetaPDF_Signer_Pem

Class hierarchy

Summary

Static Methods

decode()

public static PemHelper::decode (
string $data,
null &$label = null
): string

Decode PEM encoded data.

If no label is passed, the label of the first data package found is set. Otherwise the predefined label is used to find the first data package with that label.

Parameters
$data : string
 
$label : null

The label to match or the matched label if null.

encode()

public static PemHelper::encode (
string $data,
string $label
): string

Encodes data to PEM.

Parameters
$data : string
 
$label : string
 

extract()

public static PemHelper::extract (
string $bundle,
null $label = null
): string[]

Extracts all PEM encoded strings from a bundle.

Parameters
$bundle : string
 
$label : null

Use the label to limit the result to only strings, with a specific label ("-----BEGIN $label-----").

extractFromFile()

public static PemHelper::extractFromFile (
string $bundlePath,
null $label = null
): string[]

Extracts all PEM encoded strings from a file.

Parameters
$bundlePath : string
 
$label : null

Use the label to limit the result to only strings, with a specific label ("-----BEGIN $label-----").