Fail to parse Kerberos ASN.1
Hi, I have a problem with translate ASN.1 grammar of Kerberos from: https://cwiki.apache.org/confluence/display/DIRxSRVx10/Kerberos+ASN.1+codec
when I put:
python pyasn1gen.py KrbGrammar.asn1 > rfc4120.py
output is:
Traceback (most recent call last):
File "pyasn1gen.py", line 628, in
I don't know, maybe doing something wrong. Thank you for You help.
I haven't seen the GeneralString (IA5String) constraint syntax before, and I'm not sure what it means. Do you know? If you're just interested in getting this to work on your end, I think you can remove the (IA5String) part, it appears it was added to constrain the range of allowed strings.
I removed (IA5String) part, but still doesn't work correctly.
I think you need to be more specific for me to be able to help. It's quite possible that the Kerberos spec contains more constructs that asn1ate doesn't support.
I don't know. I'm just used official ASN.1 notation from Apache wiki. I'd love to tell you where is wrong but I don't know. Output from console is:
Traceback (most recent call last):
File "pyasn1gen.py", line 628, in
thank you for your patience :)
Here's a clue:
(line:132, col:30)
If you know your way around ASN.1, you may be able to change it to something simpler.
I wish asn1ate's parser error reporting was better, but I haven't investigated how to improve it.
So, I wonder how you solve the problem @gollda ,I also want to translate ASN.1 grammar of Kerberos from, Could you give me some tips
I think this ASN.1 file may be too long for pyparsing to handler this @kimgr
Hi, it is reaaaaally long time ago, so now I can't remember on ti. Anyway I stoped working on this beacause it was my subject of my diploma thesis and my tutor leave the company where I worked on this. So I didn't have anybody who lead me.
Oh my god! Anyway ,thank you very much
I don't think it's size-related, there's probably just some ASN.1 syntax in the file that isn't supported by asn1ate. I know most Kerberos specs use advanced ASN.1 features, so they're not easily translatable. If you can be more specific about what's going wrong (what does the ASN.1 look like, what does asn1ate say, what did you try, etc), I might be able to suggest a workaround.
@kimgr Apologize for being late, I have met the same questions with gollda. When I remove the (IA5String) part, there is an error in (line:132, col:30)
132 KDC-REQ ::= SEQUENCE {
133 -- NOTE: first tag is [1], not [0]
134 pvno [1] INTEGER (5) ,
135 msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
136 padata [3] SEQUENCE OF PA-DATA OPTIONAL
137 -- NOTE: not empty --,
138 req-body [4] KDC-REQ-BODY
139 }
there is the source of the asn.1 https://cwiki.apache.org/confluence/display/DIRxSRVx10/Kerberos+ASN.1+codec If there any way to help us solve the problem ,Just tell me , Thank you for the reply
@gollda I am so sorry for that , Could tell me your tutor's github or twitter , I am working on kerberos for a while . Congratulations on your graduation and having a good job, Thank you
@SuperXiaoxiong
135 msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
I suspect this constrained integer isn't supported by asn1ate. you can just remove the constraint and say:
msg-type [2] INTEGER,
And make sure you validate in the application layer.
OK,I will make it tomorrow,thank you very much
可用于iOS的myMail发送
2017年12月7日 星期四 +0800 22:11 发件人 [email protected] [email protected]:
@SuperXiaoxionghttps://github.com/superxiaoxiong
135 msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
I suspect this constrained integer isn't supported by asn1ate. you can just remove the constraint and say:
msg-type [2] INTEGER,
And make sure you validate in the application layer.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/kimgr/asn1ate/issues/41#issuecomment-349977752, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ARuqvdI3vWy9a9cngxjIO5UrwSy3cmluks5s9_IHgaJpZM4J20rE.
Thanks, @kimgr You are right, and your work is very nice 。The problem solved while I only need to make a little adjustments , Thank you once again!
@SuperXiaoxiong I'm glad to hear! Was this the only change you had to make to parse the Kerberos ASN.1? If so, it sounds like a priority to improve asn1ate support for constrained integers.
@kimgr (⊙o⊙)… but maybe there are some little unknown problem .
AttributeError: 'Module' object has no attribute 'resolve_tag_implicitness'
I just use another version for convience https://github.com/etingof/asn1ate.git, etingof's asn1ate ,a fork of you, It's also very nice,For your information.
but thank you anyway,Help me solve my problem. I think the support for constrained integers is the next step too.
The most important, It's very amaing to do a such a big project alone , you deserve the world's praise
Traceback (most recent call last):
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 649, in <module>
sys.exit(main())
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 640, in main
generate_pyasn1(module, output_file, modules)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 523, in generate_pyasn1
return Pyasn1Backend(sema_module, out_stream, referenced_modules).generate_c
ode()
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 145, in generate_code
details = self.generate_definition(assignment)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 159, in generate_definition
return self.generate_defn(assigned_type, type_decl)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 171, in generate_defn
return generator(class_name, t)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 280, in defn_collection_typ
e
fragment.write_line('%s.componentType = %s' % (class_name, self.generate_exp
r(t.type_decl)))
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 167, in generate_expr
return generator(t)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 308, in inline_constructed_
type
fragment.write_block(self.inline_component_types(t.components))
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 321, in inline_component_ty
pes
component_exprs.append(self.generate_expr(c))
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 167, in generate_expr
return generator(t)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 427, in inline_component_ty
pe
return "namedtype.NamedType('%s', %s)" % (t.identifier, self.generate_expr(t
.type_decl))
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 167, in generate_expr
return generator(t)
File "./asn1ate-master/asn1ate/pyasn1gen.py", line 328, in inline_tagged_type
implicitness = self.sema_module.resolve_tag_implicitness(t.implicitness, t.t
ype_decl)
AttributeError: 'Module' object has no attribute 'resolve_tag_implicitness'