diff options
Diffstat (limited to 'crypto/src/cmp')
-rw-r--r-- | crypto/src/cmp/ProtectedPkiMessage.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/src/cmp/ProtectedPkiMessage.cs b/crypto/src/cmp/ProtectedPkiMessage.cs index f99672cc7..6304b5200 100644 --- a/crypto/src/cmp/ProtectedPkiMessage.cs +++ b/crypto/src/cmp/ProtectedPkiMessage.cs @@ -126,9 +126,10 @@ namespace Org.BouncyCastle.Cmp avec.Add(m_pkiMessage.Body); byte[] enc = new DerSequence(avec).GetDerEncoded(); - streamCalculator.Stream.Write(enc, 0, enc.Length); - streamCalculator.Stream.Flush(); - Platform.Dispose(streamCalculator.Stream); + using (var stream = streamCalculator.Stream) + { + stream.Write(enc, 0, enc.Length); + } return streamCalculator.GetResult(); } |