mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
ASN1: Support enumerated types by processing them as integers.
This commit is contained in:
parent
35d6910bf3
commit
d9a3dafa0a
@ -309,10 +309,9 @@ class File_ASN1 {
|
|||||||
$current['content'] = (bool) ord($content[0]);
|
$current['content'] = (bool) ord($content[0]);
|
||||||
break;
|
break;
|
||||||
case FILE_ASN1_TYPE_INTEGER:
|
case FILE_ASN1_TYPE_INTEGER:
|
||||||
|
case FILE_ASN1_TYPE_ENUMERATED:
|
||||||
$current['content'] = new Math_BigInteger($content, -256);
|
$current['content'] = new Math_BigInteger($content, -256);
|
||||||
break;
|
break;
|
||||||
case FILE_ASN1_TYPE_ENUMERATED: // not currently supported
|
|
||||||
return false;
|
|
||||||
case FILE_ASN1_TYPE_REAL: // not currently supported
|
case FILE_ASN1_TYPE_REAL: // not currently supported
|
||||||
return false;
|
return false;
|
||||||
case FILE_ASN1_TYPE_BIT_STRING:
|
case FILE_ASN1_TYPE_BIT_STRING:
|
||||||
@ -673,6 +672,7 @@ class File_ASN1 {
|
|||||||
case FILE_ASN1_TYPE_BMP_STRING:
|
case FILE_ASN1_TYPE_BMP_STRING:
|
||||||
return $decoded['content'];
|
return $decoded['content'];
|
||||||
case FILE_ASN1_TYPE_INTEGER:
|
case FILE_ASN1_TYPE_INTEGER:
|
||||||
|
case FILE_ASN1_TYPE_ENUMERATED:
|
||||||
$temp = $decoded['content'];
|
$temp = $decoded['content'];
|
||||||
if (isset($mapping['implicit'])) {
|
if (isset($mapping['implicit'])) {
|
||||||
$temp = new Math_BigInteger($decoded['content'], -256);
|
$temp = new Math_BigInteger($decoded['content'], -256);
|
||||||
@ -875,6 +875,7 @@ class File_ASN1 {
|
|||||||
|
|
||||||
return $temp;
|
return $temp;
|
||||||
case FILE_ASN1_TYPE_INTEGER:
|
case FILE_ASN1_TYPE_INTEGER:
|
||||||
|
case FILE_ASN1_TYPE_ENUMERATED:
|
||||||
if (!isset($mapping['mapping'])) {
|
if (!isset($mapping['mapping'])) {
|
||||||
$value = $source->toBytes(true);
|
$value = $source->toBytes(true);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user