private static function JWT::signatureFromDER in Auth0 Single Sign On 8.2
Encodes signature from a DER object.
Parameters
string $der binary signature in DER format:
int $keySize the number of bits in the key:
Return value
string the signature
1 call to JWT::signatureFromDER()
File
- vendor/
firebase/ php-jwt/ src/ JWT.php, line 454
Class
- JWT
- JSON Web Token implementation, based on this spec: https://tools.ietf.org/html/rfc7519
Namespace
Firebase\JWTCode
private static function signatureFromDER($der, $keySize) {
// OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE
list($offset, $_) = self::readDER($der);
list($offset, $r) = self::readDER($der, $offset);
list($offset, $s) = self::readDER($der, $offset);
// Convert r-value and s-value from signed two's compliment to unsigned
// big-endian integers
$r = \ltrim($r, "\0");
$s = \ltrim($s, "\0");
// Pad out r and s so that they are $keySize bits long
$r = \str_pad($r, $keySize / 8, "\0", STR_PAD_LEFT);
$s = \str_pad($s, $keySize / 8, "\0", STR_PAD_LEFT);
return $r . $s;
}