Comments (5)
Hi!
Thanks for the files that helped me to reproduce the problem. Great that you managed to fix a workaround as well! :)
It appears that constructed strings are a thing in BER encoding. I added rudimentary support for this in php72 branch. That's a development branch that will be merged in the near future. It does require PHP 7.2 however. Can you checkout and try it?
from asn1.
Thanks for your quick answer! Great that you have support for this in the php72 branch. Unfortunately I might have to support PHP 7.1 also, but I will have a look at the branch!
EDIT: In my PHP 7.2 version I can use your php72 branch successfully! What about backporting the ConstructedString into master? How much effort would this be?
from asn1.
Hi!
Good to hear. I'll add the functionality to old master. I've created a php70 branch and backported what i've done so far. Feel free to try it out.
I'll add a couple of features before publishing a tag though. Maybe tomorrow.
from asn1.
I've pushed some changes to php70 branch. Given your example data, here's how one could extract the payload as a concatenated string:
$data = file_get_contents(__DIR__ . '/constructed-octet-string.der');
$content_info = Element::fromDER($data)->asUnspecified()->asSequence();
$signed_data = $content_info->at(1)->asTagged()->asExplicit()->asSequence();
$encapsulated = $signed_data->at(2)->asSequence();
$content = $encapsulated->at(1)->asTagged()->asExplicit()->asConstructedString();
echo $content->string() . "\n";
Do you think this would be sufficient?
from asn1.
Thank you! I'm using branch php70 now. I ended up as this:
$encapContentInfo = $signedData->at(2)->asSequence();
$content = $encapContentInfo->getTagged(0)->asExplicit()->asElement();
if ($content instanceof Stringable) { return $content->string(); }
from asn1.
Related Issues (16)
- CHOICE type HOT 1
- 7.4 available as 7.4snapshot
- Function usage invokeArgs() (@call_with_passing_by_reference) is deprecated. HOT 2
- Signature with indefinite length and Universal Tag 0 HOT 8
- OCTET STRING as UFT8 STRING ? HOT 2
- Example of decoding
- Error "Not a valid IA5String string." but it's valid HOT 2
- PHP 8.1 support HOT 1
- Best way to get oid from base64 encoded public key HOT 3
- two or more public key decoded
- PHP7.2: Calling assert() with a string argument is deprecated HOT 1
- Thoughts on converting some int|string values to GMP? HOT 2
- Identifiers of 'application' class HOT 5
- Sequence OF HOT 4
- OID 2.999 decoded wrong HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asn1.