From 7a9ea673ca1dc988269c870c63cbf17b13e836f4 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 5 May 2014 16:39:35 -0500 Subject: [PATCH] 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. --- phpseclib/File/ASN1.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php index da70d415..11e48541 100644 --- a/phpseclib/File/ASN1.php +++ b/phpseclib/File/ASN1.php @@ -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']);