25
25
*/
26
26
class JWT
27
27
{
28
- const ASN1_INTEGER = 0x02 ;
29
- const ASN1_SEQUENCE = 0x10 ;
30
- const ASN1_BIT_STRING = 0x03 ;
28
+ // const ASN1_INTEGER = 0x02;
29
+ // const ASN1_SEQUENCE = 0x10;
30
+ // const ASN1_BIT_STRING = 0x03;
31
+ private static $ asn1Integer = 0x02 ;
32
+ private static $ asn1Sequence = 0x10 ;
33
+ private static $ asn1BitString = 0x03 ;
31
34
32
35
/**
33
36
* When checking nbf, iat or expiration times,
@@ -494,9 +497,9 @@ private static function signatureToDER($sig)
494
497
}
495
498
496
499
return self ::encodeDER (
497
- self ::ASN1_SEQUENCE ,
498
- self ::encodeDER (self ::ASN1_INTEGER , $ r ) .
499
- self ::encodeDER (self ::ASN1_INTEGER , $ s )
500
+ self ::$ asn1Sequence ,
501
+ self ::encodeDER (self ::$ asn1Integer , $ r ) .
502
+ self ::encodeDER (self ::$ asn1Integer , $ s )
500
503
);
501
504
}
502
505
@@ -510,7 +513,7 @@ private static function signatureToDER($sig)
510
513
private static function encodeDER ($ type , $ value )
511
514
{
512
515
$ tag_header = 0 ;
513
- if ($ type === self ::ASN1_SEQUENCE ) {
516
+ if ($ type === self ::$ asn1Sequence ) {
514
517
$ tag_header |= 0x20 ;
515
518
}
516
519
@@ -575,7 +578,7 @@ private static function readDER($der, $offset = 0)
575
578
}
576
579
577
580
// Value
578
- if ($ type == self ::ASN1_BIT_STRING ) {
581
+ if ($ type == self ::$ asn1BitString ) {
579
582
$ pos ++; // Skip the first contents octet (padding indicator)
580
583
$ data = \substr ($ der , $ pos , $ len - 1 );
581
584
$ pos += $ len - 1 ;
0 commit comments