diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-07 22:30:33 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-11-07 22:30:33 +0700 |
commit | cc8742fd7e36c6bc7b773c75a797e478f21aa1df (patch) | |
tree | e7ac8d41b18e30f9168271beb404dc1a9dcba34c /crypto/src/asn1/BERBitString.cs | |
parent | Rewrite DerExternal (diff) | |
download | BouncyCastle.NET-ed25519-cc8742fd7e36c6bc7b773c75a797e478f21aa1df.tar.xz |
Add EncodeConstructed method
Diffstat (limited to 'crypto/src/asn1/BERBitString.cs')
-rw-r--r-- | crypto/src/asn1/BERBitString.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/src/asn1/BERBitString.cs b/crypto/src/asn1/BERBitString.cs index 1756ee9c0..156ea2d1f 100644 --- a/crypto/src/asn1/BERBitString.cs +++ b/crypto/src/asn1/BERBitString.cs @@ -113,9 +113,10 @@ namespace Org.BouncyCastle.Asn1 this.segmentLimit = DefaultSegmentLimit; } - private bool IsConstructed + internal override bool EncodeConstructed() { - get { return null != elements || contents.Length > segmentLimit; } + // NOTE: Assumes BER encoding + return null != elements || contents.Length > segmentLimit; } internal override int EncodedLength(bool withID) @@ -123,7 +124,7 @@ namespace Org.BouncyCastle.Asn1 throw Platform.CreateNotImplementedException("BerBitString.EncodedLength"); // TODO This depends on knowing it's not DER - //if (!IsConstructed) + //if (!EncodeConstructed()) // return EncodedLength(withID, contents.Length); //int totalLength = withID ? 4 : 3; @@ -159,7 +160,7 @@ namespace Org.BouncyCastle.Asn1 return; } - if (!IsConstructed) + if (!EncodeConstructed()) { Encode(asn1Out, withID, contents, 0, contents.Length); return; |