diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 16:08:19 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 16:08:19 +0700 |
commit | 7735c6336809bc20d10dae1c15891143d0cc54c5 (patch) | |
tree | 3f08af7faa908520ae06944744c1e86aeea395d6 /crypto/src/asn1/DERSequenceGenerator.cs | |
parent | Remove unused class (diff) | |
download | BouncyCastle.NET-ed25519-7735c6336809bc20d10dae1c15891143d0cc54c5.tar.xz |
Asn1Generator implements IDisposable
- now expects BerOctetStringGenerator to be disposed, not just its octets stream
Diffstat (limited to 'crypto/src/asn1/DERSequenceGenerator.cs')
-rw-r--r-- | crypto/src/asn1/DERSequenceGenerator.cs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/src/asn1/DERSequenceGenerator.cs b/crypto/src/asn1/DERSequenceGenerator.cs index 12c978508..be240a86c 100644 --- a/crypto/src/asn1/DERSequenceGenerator.cs +++ b/crypto/src/asn1/DERSequenceGenerator.cs @@ -7,21 +7,22 @@ namespace Org.BouncyCastle.Asn1 { private readonly MemoryStream _bOut = new MemoryStream(); - public DerSequenceGenerator( - Stream outStream) + public DerSequenceGenerator(Stream outStream) : base(outStream) { } - public DerSequenceGenerator( - Stream outStream, - int tagNo, - bool isExplicit) + public DerSequenceGenerator(Stream outStream, int tagNo, bool isExplicit) : base(outStream, tagNo, isExplicit) { } - public override void AddObject(Asn1Encodable obj) + protected override void Finish() + { + WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray()); + } + + public override void AddObject(Asn1Encodable obj) { obj.EncodeTo(_bOut, Asn1Encodable.Der); } @@ -35,10 +36,5 @@ namespace Org.BouncyCastle.Asn1 { return _bOut; } - - public override void Close() - { - WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray()); - } } } |