-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Trying to encode this ASN.1 sequence
AuthorizationList ::= SEQUENCE {
purpose [1] SET OF INTEGER OPTIONAL,
algorithm [2] INTEGER OPTIONAL,
keySize [3] INTEGER OPTIONAL,
digest [5] SET OF INTEGER OPTIONAL,
ecCurve [10] INTEGER OPTIONAL,
noAuthRequired [503] NULL OPTIONAL,
creationDateTime [701] INTEGER OPTIONAL,
origin [702] INTEGER OPTIONAL,
rootOfTrust [704] RootOfTrust OPTIONAL,
osVersion [705] INTEGER OPTIONAL,
osPatchLevel [706] INTEGER OPTIONAL,
attestationApplicationId [709] OCTET STRING OPTIONAL,
attestationIdSerial [713] OCTET STRING OPTIONAL,
vendorPatchLevel [718] INTEGER OPTIONAL,
bootPatchLevel [719] INTEGER OPTIONAL
}
I used the compiler to turn that into this class
//
// This file was generated by the BinaryNotes compiler (created by Abdulla Abdurakhmanov, modified by Sylvain Prevost).
// See http://bnotes.sourceforge.net
// Any modifications to this file will be lost upon recompilation of the source ASN.1.
//
using System;
using System.Numerics;
using org.bn.attributes;
using org.bn.attributes.constraints;
using org.bn.coders;
using org.bn.types;
using org.bn;
namespace Test
{
[ASN1PreparedElement]
[ASN1Sequence(Name = "AuthorizationList", IsSet = false)]
public class AuthorizationList : IASN1PreparedElement
{
private ICollection<BigInteger> purpose_;
private bool purpose_present = false;
[ASN1Integer(Name = "")]
[ASN1SequenceOf(Name = "purpose", IsSetOf = true)]
[ASN1Element(Name = "purpose", IsOptional = true, HasTag = true, Tag = 1, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public ICollection<BigInteger> Purpose
{
get { return purpose_; }
set { purpose_ = value; purpose_present = true; }
}
private BigInteger algorithm_;
private bool algorithm_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "algorithm", IsOptional = true, HasTag = true, Tag = 2, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger Algorithm
{
get { return algorithm_; }
set { algorithm_ = value; algorithm_present = true; }
}
private BigInteger keySize_;
private bool keySize_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "keySize", IsOptional = true, HasTag = true, Tag = 3, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger KeySize
{
get { return keySize_; }
set { keySize_ = value; keySize_present = true; }
}
private ICollection<BigInteger> digest_;
private bool digest_present = false;
[ASN1Integer(Name = "")]
[ASN1SequenceOf(Name = "digest", IsSetOf = true)]
[ASN1Element(Name = "digest", IsOptional = true, HasTag = true, Tag = 5, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public ICollection<BigInteger> Digest
{
get { return digest_; }
set { digest_ = value; digest_present = true; }
}
private BigInteger ecCurve_;
private bool ecCurve_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "ecCurve", IsOptional = true, HasTag = true, Tag = 10, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger EcCurve
{
get { return ecCurve_; }
set { ecCurve_ = value; ecCurve_present = true; }
}
private NullObject noAuthRequired_;
private bool noAuthRequired_present = false;
[ASN1Null(Name = "noAuthRequired")]
[ASN1Element(Name = "noAuthRequired", IsOptional = true, HasTag = true, Tag = 503, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public NullObject NoAuthRequired
{
get { return noAuthRequired_; }
set { noAuthRequired_ = value; noAuthRequired_present = true; }
}
private BigInteger creationDateTime_;
private bool creationDateTime_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "creationDateTime", IsOptional = true, HasTag = true, Tag = 701, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger CreationDateTime
{
get { return creationDateTime_; }
set { creationDateTime_ = value; creationDateTime_present = true; }
}
private BigInteger origin_;
private bool origin_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "origin", IsOptional = true, HasTag = true, Tag = 702, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger Origin
{
get { return origin_; }
set { origin_ = value; origin_present = true; }
}
private RootOfTrust rootOfTrust_;
private bool rootOfTrust_present = false;
[ASN1Element(Name = "rootOfTrust", IsOptional = true, HasTag = true, Tag = 704, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public RootOfTrust RootOfTrust
{
get { return rootOfTrust_; }
set { rootOfTrust_ = value; rootOfTrust_present = true; }
}
private BigInteger osVersion_;
private bool osVersion_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "osVersion", IsOptional = true, HasTag = true, Tag = 705, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger OsVersion
{
get { return osVersion_; }
set { osVersion_ = value; osVersion_present = true; }
}
private BigInteger osPatchLevel_;
private bool osPatchLevel_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "osPatchLevel", IsOptional = true, HasTag = true, Tag = 706, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger OsPatchLevel
{
get { return osPatchLevel_; }
set { osPatchLevel_ = value; osPatchLevel_present = true; }
}
private byte[] attestationApplicationId_;
private bool attestationApplicationId_present = false;
[ASN1OctetString(Name = "")]
[ASN1Element(Name = "attestationApplicationId", IsOptional = true, HasTag = true, TagClass = TagClasses.ContextSpecific, Tag = 709, IsImplicitTag = false, HasDefaultValue = false)]
public byte[] AttestationApplicationId
{
get { return attestationApplicationId_; }
set { attestationApplicationId_ = value; attestationApplicationId_present = true; }
}
private byte[] attestationIdSerial_;
private bool attestationIdSerial_present = false;
[ASN1OctetString(Name = "")]
[ASN1Element(Name = "attestationIdSerial", IsOptional = true, HasTag = true, Tag = 713, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public byte[] AttestationIdSerial
{
get { return attestationIdSerial_; }
set { attestationIdSerial_ = value; attestationIdSerial_present = true; }
}
private BigInteger vendorPatchLevel_;
private bool vendorPatchLevel_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "vendorPatchLevel", IsOptional = true, HasTag = true, Tag = 718, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger VendorPatchLevel
{
get { return vendorPatchLevel_; }
set { vendorPatchLevel_ = value; vendorPatchLevel_present = true; }
}
private BigInteger bootPatchLevel_;
private bool bootPatchLevel_present = false;
[ASN1Integer(Name = "")]
[ASN1Element(Name = "bootPatchLevel", IsOptional = true, HasTag = true, Tag = 719, TagClass = TagClasses.ContextSpecific, IsImplicitTag = false, HasDefaultValue = false)]
public BigInteger BootPatchLevel
{
get { return bootPatchLevel_; }
set { bootPatchLevel_ = value; bootPatchLevel_present = true; }
}
public bool isPurposePresent()
{
return purpose_present == true;
}
public bool isAlgorithmPresent()
{
return algorithm_present == true;
}
public bool isKeySizePresent()
{
return keySize_present == true;
}
public bool isDigestPresent()
{
return digest_present == true;
}
public bool isEcCurvePresent()
{
return ecCurve_present == true;
}
public bool isCreationDateTimePresent()
{
return creationDateTime_present == true;
}
public bool isOriginPresent()
{
return origin_present == true;
}
public bool isRootOfTrustPresent()
{
return rootOfTrust_present == true;
}
public bool isOsVersionPresent()
{
return osVersion_present == true;
}
public bool isOsPatchLevelPresent()
{
return osPatchLevel_present == true;
}
public bool isAttestationApplicationIdPresent()
{
return attestationApplicationId_present == true;
}
public bool isAttestationIdSerialPresent()
{
return attestationIdSerial_present == true;
}
public bool isVendorPatchLevelPresent()
{
return vendorPatchLevel_present == true;
}
public bool isBootPatchLevelPresent()
{
return bootPatchLevel_present == true;
}
public void initWithDefaults()
{
}
private static IASN1PreparedElementData preparedData = CoderFactory.getInstance().newPreparedElementData(typeof(AuthorizationList));
public IASN1PreparedElementData PreparedData
{
get { return preparedData; }
}
}
}
When I was trying to figure it out myself I debugged the project and saw that the null reference exception was happening on this line when trying to encode the Digest
field.
I'm sure I'm just missing something small, but I would really appreciate some help or advice. Thanks!
Metadata
Metadata
Assignees
Labels
No labels