phpdftk API Documentation

SaslPrep
in package

FinalYes

SASLprep password normalization — RFC 4013.

Prepares Unicode strings for use as passwords in PDF 2.0 encryption (ISO 32000-2 §7.6.4.3.2). Uses the Stringprep framework (RFC 3454) with the SASLprep profile.

Table of Contents

Methods

prepare()  : string
Prepare a password string per SASLprep.

Methods

prepare()

Prepare a password string per SASLprep.

public static prepare(string $input) : string

Steps:

  1. Map: replace non-ASCII spaces with U+0020, remove commonly-mapped-to-nothing chars
  2. Normalize: NFKC normalization
  3. Prohibit: reject strings with prohibited characters
  4. Check bidi: validate bidirectional text rules

If the PHP intl extension is not available, mapping and prohibit/bidi checks are still performed but NFKC normalization is skipped (most passwords are ASCII and don't need normalization).

Parameters
$input : string
Return values
string

        
On this page

Search results