mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-27 04:46:26 +01:00
ASN1: make File_ASN1 accept int primitives and not just Math_BigInteger objects when an integer is expected
The code to convert the regular integer type into the appropriate format could all just be in-line'd when an integer primitive is used but this approach is easier to read.
This commit is contained in:
parent
4fd72af3a2
commit
7a9ea673ca
@ -950,6 +950,9 @@ class File_ASN1
|
||||
case FILE_ASN1_TYPE_INTEGER:
|
||||
case FILE_ASN1_TYPE_ENUMERATED:
|
||||
if (!isset($mapping['mapping'])) {
|
||||
if (is_int($source)) {
|
||||
$source = new Math_BigInteger($source);
|
||||
}
|
||||
$value = $source->toBytes(true);
|
||||
} else {
|
||||
$value = array_search($source, $mapping['mapping']);
|
||||
|
Loading…
Reference in New Issue
Block a user