Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence of OCTET STRING #3

Closed
zivillian opened this issue Sep 18, 2018 · 4 comments
Closed

Sequence of OCTET STRING #3

zivillian opened this issue Sep 18, 2018 · 4 comments
Labels
critical prevents a release

Comments

@zivillian
Copy link
Owner

RFC 4511 - 4.5.1

SearchRequest ::= [APPLICATION 3] SEQUENCE {
     baseObject      LDAPDN,
...
     attributes      AttributeSelection }

AttributeSelection ::= SEQUENCE OF selector LDAPString
                -- The LDAPString is constrained to
                -- <attributeSelector> in Section 4.5.1.8

LDAPString ::= OCTET STRING -- UTF-8 encoded,
                                    -- [ISO10646] characters

//TODO
[AnyValue]
public ReadOnlyMemory<byte> Attributes;

I can't combine SequenceOf and OctetString.

@zivillian zivillian added the critical prevents a release label Sep 18, 2018
@zivillian
Copy link
Owner Author

May be a dupe of dotnet/corefx#28683

@filipnavara
Copy link

This should work just fine with the ASN code generator. That said, why doesn't ReadOnlyMemory<byte>[] with SequenceOf and OctetString (and ExpectedTag) work for you?

@zivillian
Copy link
Owner Author

It throws an Exception in

if (typeAttrs.Length > 1)
{
throw new AsnSerializationConstraintException(
String.Format(
fieldInfo.Name,
fieldInfo.DeclaringType.FullName,
typeof(AsnTypeAttribute).FullName));

because both derive from AsnTypeAttribute.
public sealed class SequenceOfAttribute : AsnTypeAttribute

public sealed class OctetStringAttribute : AsnTypeAttribute

@filipnavara
Copy link

It's possible to workaround that with a dummy Choice struct instead of using OctetString directly, but it's a bit of a hack.

Definitely recommend the code generator as an alternative here. The serializer is unlikely to get shipped as production ready anyway. In case the CoreFX guys decide to ship it then it should probably be addressed though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical prevents a release
Projects
None yet
Development

No branches or pull requests

2 participants