Comments (4)
Hi!
Could you give an example of what you're trying to encode?
from asn1.
The incoming service parameter is asn:
Msg ::= CHOICE {
request [0] Request,
response [1] Response
}
ResponseRecord ::= SEQUENCE {
number [0] UTF8String,
oper-type [2] INTEGER,
}
Response ::= SEQUENCE OF ResponseRecord
Request ::= SEQUENCE OF UTF8String
I try:
$request = new Sequence(
new UTF8String('77021780117')
);
print(bin2hex($request->toDER()));
//300d0c0b3737303231373830313137
And service can not decode this.
from asn1.
You have to use tagging due to CHOICE
. Your full ASN.1 schema should indicate what's the default tagging mode. I'll assume implicit tagging here. Try the following:
$request = new ImplicitlyTaggedType(
0,
new Sequence(
new UTF8String('77021780117')
)
);
If explicit tagging must be used instead, just replace ImplicitlyTaggedType
with ExplicitlyTaggedType
.
from asn1.
you are right, thanks
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
- Constructed OCTET_STRING - a real-life example HOT 5
- 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
- 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.