I'm currently in the process of writing a kerberos encoder/decoder using this DER crate. In https://www.rfc-editor.org/rfc/rfc4120#section-5.4.1 the specification is:
AS-REQ ::= [APPLICATION 10] KDC-REQ
TGS-REQ ::= [APPLICATION 12] KDC-REQ
KDC-REQ ::= SEQUENCE {
-- NOTE: first tag is [1], not [0]
pvno [1] INTEGER (5) ,
msg-type [2] INTEGER (10 -- AS -- | 12 -- TGS --),
padata [3] SEQUENCE OF PA-DATA OPTIONAL
-- NOTE: not empty --,
req-body [4] KDC-REQ-BODY
}
For an example: https://asn1.jsteel.dev/#aoGyMIGvoQMCAQWiAwIBCqMaMBgwCqEEAgIAlqICBAAwCqEEAgIAlaICBACkgYYwgYOgBwMFAAAAABChFDASoAMCAQGhCzAJGwd3aWxsaWFtogsbCUtLRENQLkRFVqMeMBygAwIBAqEVMBMbBmtyYnRndBsJS0tEQ1AuREVWpREYDzIwMjQwNDE3MDQxNTQ5WqcGAgR_vaeuqBowGAIBEgIBEQIBFAIBEwIBEAIBFwIBGQIBGg
The problem I'm having is I can't see how I would handle this with der_derive. I can't map "application tags" to an enum of potential inner variants.
And from the "reader" types if I implemented it manually, I see there is https://docs.rs/der/0.7.9/der/trait.Reader.html#method.peek_tag but not "pop_tag". I probably need to try and experiment a bit more, but do you have any advice on how to decode this "nicely"?
PS: Would this crate be opposed to some extra additions that have some kerberos or LDAP specific use cases? For example, Kerberos needs an IA5String that has a GeneralString Tag so that would be a KerberosString type.
Thanks!
I'm currently in the process of writing a kerberos encoder/decoder using this DER crate. In https://www.rfc-editor.org/rfc/rfc4120#section-5.4.1 the specification is:
For an example: https://asn1.jsteel.dev/#aoGyMIGvoQMCAQWiAwIBCqMaMBgwCqEEAgIAlqICBAAwCqEEAgIAlaICBACkgYYwgYOgBwMFAAAAABChFDASoAMCAQGhCzAJGwd3aWxsaWFtogsbCUtLRENQLkRFVqMeMBygAwIBAqEVMBMbBmtyYnRndBsJS0tEQ1AuREVWpREYDzIwMjQwNDE3MDQxNTQ5WqcGAgR_vaeuqBowGAIBEgIBEQIBFAIBEwIBEAIBFwIBGQIBGg
The problem I'm having is I can't see how I would handle this with der_derive. I can't map "application tags" to an enum of potential inner variants.
And from the "reader" types if I implemented it manually, I see there is https://docs.rs/der/0.7.9/der/trait.Reader.html#method.peek_tag but not "pop_tag". I probably need to try and experiment a bit more, but do you have any advice on how to decode this "nicely"?
PS: Would this crate be opposed to some extra additions that have some kerberos or LDAP specific use cases? For example, Kerberos needs an IA5String that has a GeneralString Tag so that would be a KerberosString type.
Thanks!