// DEFAULT value handler for SaltLength.
{
- AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER);
+ const int AsnManagedIntegerDerMaxEncodeSize = 6;
+ AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER, initialCapacity: AsnManagedIntegerDerMaxEncodeSize);
tmp.WriteInteger(SaltLength);
if (!tmp.EncodedValueEquals(DefaultSaltLength))
// DEFAULT value handler for TrailerField.
{
- AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER);
+ const int AsnManagedIntegerDerMaxEncodeSize = 6;
+ AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER, initialCapacity: AsnManagedIntegerDerMaxEncodeSize);
tmp.WriteInteger(TrailerField);
if (!tmp.EncodedValueEquals(DefaultTrailerField))
<xsl:when test="@defaultDerInit and not(@explicitTag)" xml:space="preserve">
// DEFAULT value handler for <xsl:value-of select="@name" />.
- {
- AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER);<xsl:apply-templates select="." mode="EncodeValue">
+ {<xsl:apply-templates select="." mode="AsnWriterDefaultDer">
+ <xsl:with-param name="writerName" select="'tmp'" />
+ <xsl:with-param name="indent" select="concat(' ', $indent)" />
+ </xsl:apply-templates><xsl:apply-templates select="." mode="EncodeValue">
<xsl:with-param name="writerName" select="'tmp'" />
<xsl:with-param name="indent" select="concat(' ', $indent)" />
</xsl:apply-templates>
</xsl:choose>
</xsl:template>
+ <xsl:template match="*" mode="AsnWriterDefaultDer" xml:space="default">
+ <xsl:param name="writerName" />
+ <xsl:param name="indent" />
+ <xsl:choose>
+ <xsl:when test="self::asn:Boolean" xml:space="preserve">
+ <xsl:value-of select="$indent"/>const int AsnBoolDerEncodeSize = 3;
+ <xsl:value-of select="$indent"/>AsnWriter <xsl:value-of select="$writerName"/> = new AsnWriter(AsnEncodingRules.DER, initialCapacity: AsnBoolDerEncodeSize);</xsl:when>
+ <xsl:when test="self::asn:Integer[@backingType = 'int']" xml:space="preserve">
+ <xsl:value-of select="$indent"/>const int AsnManagedIntegerDerMaxEncodeSize = 6;
+ <xsl:value-of select="$indent"/>AsnWriter <xsl:value-of select="$writerName"/> = new AsnWriter(AsnEncodingRules.DER, initialCapacity: AsnManagedIntegerDerMaxEncodeSize);</xsl:when>
+ <xsl:otherwise xml:space="preserve">
+ <xsl:value-of select="$indent"/>AsnWriter <xsl:value-of select="$writerName"/> = new AsnWriter(AsnEncodingRules.DER);</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
<!-- Struct OPTIONAL -->
<xsl:template match="asn:AsnType | asn:AnyValue | asn:Boolean | asn:Integer | asn:BitString | asn:NamedBitList | asn:OctetString | asn:Enumerated | asn:UtcTime | asn:GeneralizedTime" mode="EncodeOptional">
<xsl:when test="@defaultDerInit and @explicitTag" xml:space="preserve">
// DEFAULT value handler for <xsl:value-of select="@name" />.
- {
- AsnWriter tmp = new AsnWriter(AsnEncodingRules.DER);<xsl:apply-templates select="." mode="EncodeSimpleValue">
+ {<xsl:apply-templates select="." mode="AsnWriterDefaultDer">
+ <xsl:with-param name="writerName" select="'tmp'" />
+ <xsl:with-param name="indent" select="concat(' ', $indent)" />
+ </xsl:apply-templates><xsl:apply-templates select="." mode="EncodeSimpleValue">
<xsl:with-param name="writerName" select="'tmp'" />
<xsl:with-param name="indent" select="concat(' ', $indent)" />
</xsl:apply-templates>