Hey Rob,

I'm not sure it was a long time ago.  My understanding of the application flag is that it is for encoding tags that are application specific and not for ASN1 defined values.  So the Context is an Application context not a default value.  If we have a specific context and special rules for encoding or decoding a value it would be marked as application otherwise it should be marked as non-application specific to handle it using default rules.  I believe that for Objects this makes sense if we are encoding them but you could easily encode them as class name with a bucket of values with default encoding.  

Wish I had more time to work on this but I'm sorry I don't right now.  Good luck with it.  Let me know what you decide to do with it.  Happy to try and keep up to date on it.

All the best,

Ron Teitelbaum

On Fri, Sep 9, 2022 at 11:11 AM rabbit <rabbit@callistohouse.org> wrote:

Hi Ron,

I see that originally when you had introduce ASN1 to our library, you defined the classes ASN1WrapperConstructedType and ASN1ExplicitContextValue. I tried to implement decode and encode to ASN1WrapperConstructedType, but only partially. I used your ASN1ExplicitContextValue but have not completed it. Now I have the need to implement, as I attempt to switch the PromisesRemote to using ASN1 encoding, rather than STON.

In looking at Object>>#asn1Tag we construct a tag with

Object>>#asn1Tag

    ^ (ASN1MappedSequenceType new asn1Tag "48"
            bitOr: 2r11000000) "Application"
            bitOr: 2r00100000 "Constructed"

So we are an application class and constructed. In ASN1OutputStream>>#typeForTag: tag, the tag is broken down into the numericTag, the tagClass (application) and whether it is constructed. This is called from decode: anObject with the call:

^ self encode: anObject with Type: (self typeForTag: anObject asn1Tag)

So Object>>#asn1Tag is called. So with a ASN1 non-registered object, we end up with a ASN1WrapperConstructedType.

I am totally unsure about how the ASN1ExplicitContextValue should be used with the ASN1WrapperConstructedType, nor how it builds the context from the ivars of the provided anonymous object.

My related concern is whether all of the crypto objects with ASN1 definitions ought to be of the application tagClass.

Any guidance you could provide me for this would be very welcome! If it is not too far back in history! Heh!

Thanks!

-- 
Have a good one; keep it, light.
Kindly,
rabbit
. .. … ‘…^,^

Sent from Callisto House :: decentralized mobile homeless solutions