PHP Class Minishlink\WebPush\Encryption

Afficher le fichier Open project: minishlink/web-push Class Usage Examples

Méthodes publiques

Méthode Description
encrypt ( string $payload, string $userPublicKey, string $userAuthToken, boolean $nativeEncryption ) : array
padPayload ( string $payload, boolean $maxLengthToPad ) : string

Private Methods

Méthode Description
createContext ( $clientPublicKey, $serverPublicKey ) : string Creates a context for deriving encyption parameters.
createInfo ( $type, $context ) : string Returns an info record. See sections 3.2 and 3.3 of {@link https://tools.ietf.org/html/draft-ietf-httpbis-encryption-encoding-00} From {@link https://github.com/GoogleChrome/push-encryption-node/blob/master/src/encrypt.js}.
hkdf ( $salt, $ikm, $info, $length ) : string HMAC-based Extract-and-Expand Key Derivation Function (HKDF).

Method Details

encrypt() public static méthode

public static encrypt ( string $payload, string $userPublicKey, string $userAuthToken, boolean $nativeEncryption ) : array
$payload string With padding
$userPublicKey string Base 64 encoded (MIME or URL-safe)
$userAuthToken string Base 64 encoded (MIME or URL-safe)
$nativeEncryption boolean Use OpenSSL (>PHP7.1)
Résultat array

padPayload() public static méthode

public static padPayload ( string $payload, boolean $maxLengthToPad ) : string
$payload string
$maxLengthToPad boolean
Résultat string padded payload (plaintext)