public function wrapPad(string $key, string $kek): string
    {
        if (!strlen($key)) {
            throw new \UnexpectedValueException(
                "Key must have at least one octet.");
        }
        $this->_checkKEKSize($kek);
        list($key, $aiv) = $this->_padKey($key);
        // If the padded key contains exactly eight octets,
        // let the ciphertext be:
        // C[0] | C[1] = ENC(K, A | P[1]).
        if (8 == strlen($key)) {
            return $this->_encrypt($kek, $aiv . $key);
        }
        // build plaintext blocks and apply normal wrapping with AIV as an
        // initial value
        $P = [];
        $i = 1;
        foreach (str_split($key, 8) as $val) {
            $P[$i++] = $val;
        }
        $C = $this->_wrapBlocks($P, $kek, $aiv);
        return implode("", $C);
    }