public function Verifier::parseB64String in Automatic Updates 7
Same name and namespace in other branches
- 8 vendor/drupal/php-signify/src/Verifier.php \Drupal\Signify\Verifier::parseB64String()
Parse the contents of a base 64 encoded file.
Parameters
string $b64: The file contents.
int $length: The length of the data, either 32 or 64 bytes.
Return value
\Drupal\Signify\VerifierB64Data An object with the validated and decoded data.
Throws
\Drupal\Signify\VerifierException
2 calls to Verifier::parseB64String()
- Verifier::getPublicKey in vendor/
drupal/ php-signify/ src/ Verifier.php - Get the public key data.
- Verifier::verifyMessage in vendor/
drupal/ php-signify/ src/ Verifier.php - Verify a string message signed with plain Signify format.
File
- vendor/
drupal/ php-signify/ src/ Verifier.php, line 96
Class
Namespace
Drupal\SignifyCode
public function parseB64String($b64, $length) {
$parts = explode("\n", $b64);
if (count($parts) !== 3) {
throw new VerifierException("Invalid format; must contain two newlines, one after comment and one after base64");
}
$comment = $parts[0];
if (substr($comment, 0, self::COMMENTHDRLEN) !== self::COMMENTHDR) {
throw new VerifierException(sprintf("Invalid format; comment must start with '%s'", self::COMMENTHDR));
}
if (strlen($comment) > self::COMMENTHDRLEN + self::COMMENTMAXLEN) {
throw new VerifierException(sprintf("Invalid format; comment longer than %d bytes", self::COMMENTMAXLEN));
}
return new VerifierB64Data($parts[1], $length);
}