diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-04 16:11:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-04 16:11:28 +0700 |
commit | ed2134bdcf763b2b6a11742911b4c5efd1de4550 (patch) | |
tree | b23f6dfb1ee88ddc393276229c014204b42aea22 /crypto/src/cms | |
parent | Perform counter increment without branches (diff) | |
download | BouncyCastle.NET-ed25519-ed2134bdcf763b2b6a11742911b4c5efd1de4550.tar.xz |
Change Close calls to Dispose calls for PORTABLE
Diffstat (limited to 'crypto/src/cms')
-rw-r--r-- | crypto/src/cms/CMSAuthenticatedDataGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs | 5 | ||||
-rw-r--r-- | crypto/src/cms/CMSCompressedData.cs | 3 | ||||
-rw-r--r-- | crypto/src/cms/CMSCompressedDataGenerator.cs | 5 | ||||
-rw-r--r-- | crypto/src/cms/CMSCompressedDataStreamGenerator.cs | 7 | ||||
-rw-r--r-- | crypto/src/cms/CMSContentInfoParser.cs | 3 | ||||
-rw-r--r-- | crypto/src/cms/CMSEnvelopedDataGenerator.cs | 4 | ||||
-rw-r--r-- | crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 4 | ||||
-rw-r--r-- | crypto/src/cms/CMSProcessableFile.cs | 3 | ||||
-rw-r--r-- | crypto/src/cms/CMSProcessableInputStream.cs | 3 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataParser.cs | 8 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataStreamGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/cms/CMSTypedStream.cs | 3 |
14 files changed, 35 insertions, 27 deletions
diff --git a/crypto/src/cms/CMSAuthenticatedDataGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataGenerator.cs index 846c19a24..131a4753f 100644 --- a/crypto/src/cms/CMSAuthenticatedDataGenerator.cs +++ b/crypto/src/cms/CMSAuthenticatedDataGenerator.cs @@ -9,6 +9,7 @@ using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.IO; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; namespace Org.BouncyCastle.Cms @@ -83,10 +84,9 @@ namespace Org.BouncyCastle.Cms content.Write(mOut); - mOut.Close(); - bOut.Close(); + Platform.Dispose(mOut); - encContent = new BerOctetString(bOut.ToArray()); + encContent = new BerOctetString(bOut.ToArray()); byte[] macOctets = MacUtilities.DoFinal(mac); macResult = new DerOctetString(macOctets); diff --git a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs index 2603cb380..a9879a6fc 100644 --- a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs @@ -9,6 +9,7 @@ using Org.BouncyCastle.Crypto.Generators; using Org.BouncyCastle.Crypto.IO; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; namespace Org.BouncyCastle.Cms @@ -253,9 +254,9 @@ namespace Org.BouncyCastle.Cms public override void Close() { - macStream.Close(); + Platform.Dispose(macStream); - // TODO Parent context(s) should really be be closed explicitly + // TODO Parent context(s) should really be be closed explicitly eiGen.Close(); diff --git a/crypto/src/cms/CMSCompressedData.cs b/crypto/src/cms/CMSCompressedData.cs index 2d0107e88..21651f041 100644 --- a/crypto/src/cms/CMSCompressedData.cs +++ b/crypto/src/cms/CMSCompressedData.cs @@ -3,6 +3,7 @@ using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Zlib; namespace Org.BouncyCastle.Cms @@ -56,7 +57,7 @@ namespace Org.BouncyCastle.Cms } finally { - zIn.Close(); + Platform.Dispose(zIn); } } diff --git a/crypto/src/cms/CMSCompressedDataGenerator.cs b/crypto/src/cms/CMSCompressedDataGenerator.cs index 00e2a3df4..d51de1026 100644 --- a/crypto/src/cms/CMSCompressedDataGenerator.cs +++ b/crypto/src/cms/CMSCompressedDataGenerator.cs @@ -5,6 +5,7 @@ using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Zlib; namespace Org.BouncyCastle.Cms @@ -45,9 +46,9 @@ namespace Org.BouncyCastle.Cms content.Write(zOut); - zOut.Close(); + Platform.Dispose(zOut); - comAlgId = new AlgorithmIdentifier(new DerObjectIdentifier(compressionOid)); + comAlgId = new AlgorithmIdentifier(new DerObjectIdentifier(compressionOid)); comOcts = new BerOctetString(bOut.ToArray()); } catch (IOException e) diff --git a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs index db0d19845..73832f5f3 100644 --- a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs @@ -4,6 +4,7 @@ using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; using Org.BouncyCastle.Utilities.Zlib; @@ -126,11 +127,11 @@ namespace Org.BouncyCastle.Cms public override void Close() { - _out.Close(); + Platform.Dispose(_out); - // TODO Parent context(s) should really be be closed explicitly + // TODO Parent context(s) should really be be closed explicitly - _eiGen.Close(); + _eiGen.Close(); _cGen.Close(); _sGen.Close(); base.Close(); diff --git a/crypto/src/cms/CMSContentInfoParser.cs b/crypto/src/cms/CMSContentInfoParser.cs index fde06cf4c..a7b43f295 100644 --- a/crypto/src/cms/CMSContentInfoParser.cs +++ b/crypto/src/cms/CMSContentInfoParser.cs @@ -3,6 +3,7 @@ using System.IO; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.Cms; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Cms { @@ -41,7 +42,7 @@ namespace Org.BouncyCastle.Cms */ public void Close() { - this.data.Close(); + Platform.Dispose(this.data); } } } diff --git a/crypto/src/cms/CMSEnvelopedDataGenerator.cs b/crypto/src/cms/CMSEnvelopedDataGenerator.cs index 3b861cde5..d260e998a 100644 --- a/crypto/src/cms/CMSEnvelopedDataGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataGenerator.cs @@ -80,9 +80,9 @@ namespace Org.BouncyCastle.Cms content.Write(cOut); - cOut.Close(); + Platform.Dispose(cOut); - encContent = new BerOctetString(bOut.ToArray()); + encContent = new BerOctetString(bOut.ToArray()); } catch (SecurityUtilityException e) { diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index a63ea7b7f..17c49ed07 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -257,9 +257,9 @@ namespace Org.BouncyCastle.Cms public override void Close() { - _out.Close(); + Platform.Dispose(_out); - // TODO Parent context(s) should really be be closed explicitly + // TODO Parent context(s) should really be be closed explicitly _eiGen.Close(); diff --git a/crypto/src/cms/CMSProcessableFile.cs b/crypto/src/cms/CMSProcessableFile.cs index 764d138f0..b514bdbda 100644 --- a/crypto/src/cms/CMSProcessableFile.cs +++ b/crypto/src/cms/CMSProcessableFile.cs @@ -2,6 +2,7 @@ using System; using System.IO; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; namespace Org.BouncyCastle.Cms @@ -37,7 +38,7 @@ namespace Org.BouncyCastle.Cms { Stream inStr = GetInputStream(); Streams.PipeAll(inStr, zOut); - inStr.Close(); + Platform.Dispose(inStr); } /// <returns>The file handle</returns> diff --git a/crypto/src/cms/CMSProcessableInputStream.cs b/crypto/src/cms/CMSProcessableInputStream.cs index 6dff7c212..b2abd6f71 100644 --- a/crypto/src/cms/CMSProcessableInputStream.cs +++ b/crypto/src/cms/CMSProcessableInputStream.cs @@ -1,6 +1,7 @@ using System; using System.IO; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; namespace Org.BouncyCastle.Cms @@ -29,7 +30,7 @@ namespace Org.BouncyCastle.Cms CheckSingleUsage(); Streams.PipeAll(input, output); - input.Close(); + Platform.Dispose(input); } [Obsolete] diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index a80cde509..f63ed874e 100644 --- a/crypto/src/cms/CMSSignedDataGenerator.cs +++ b/crypto/src/cms/CMSSignedDataGenerator.cs @@ -173,7 +173,7 @@ namespace Org.BouncyCastle.Cms content.Write(sigStr); } - sigStr.Close(); + Platform.Dispose(sigStr); byte[] sigBytes = ((IBlockResult)calculator.GetResult()).Collect(); Asn1Set unsignedAttr = null; diff --git a/crypto/src/cms/CMSSignedDataParser.cs b/crypto/src/cms/CMSSignedDataParser.cs index e5674a4cf..e5e6edc58 100644 --- a/crypto/src/cms/CMSSignedDataParser.cs +++ b/crypto/src/cms/CMSSignedDataParser.cs @@ -384,7 +384,7 @@ namespace Org.BouncyCastle.Cms // gen.AddSigners(parser.GetSignerInfos()); - contentOut.Close(); + Platform.Dispose(contentOut); return outStr; } @@ -434,12 +434,12 @@ namespace Org.BouncyCastle.Cms gen.AddSigners(parser.GetSignerInfos()); - contentOut.Close(); + Platform.Dispose(contentOut); - return outStr; + return outStr; } - private static Asn1Set GetAsn1Set( + private static Asn1Set GetAsn1Set( Asn1SetParser asn1SetParser) { return asn1SetParser == null diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index 223fdb39d..746538ebd 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -636,7 +636,7 @@ namespace Org.BouncyCastle.Cms { content.Write(signedOut); } - signedOut.Close(); + Platform.Dispose(signedOut); } // RFC3852, section 5.1: @@ -811,9 +811,9 @@ namespace Org.BouncyCastle.Cms public override void Close() { - _out.Close(); + Platform.Dispose(_out); - // TODO Parent context(s) should really be be closed explicitly + // TODO Parent context(s) should really be be closed explicitly _eiGen.Close(); diff --git a/crypto/src/cms/CMSTypedStream.cs b/crypto/src/cms/CMSTypedStream.cs index b7b390c4c..681583765 100644 --- a/crypto/src/cms/CMSTypedStream.cs +++ b/crypto/src/cms/CMSTypedStream.cs @@ -2,6 +2,7 @@ using System; using System.IO; using Org.BouncyCastle.Asn1.Pkcs; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.IO; namespace Org.BouncyCastle.Cms @@ -52,7 +53,7 @@ namespace Org.BouncyCastle.Cms public void Drain() { Streams.Drain(_in); - _in.Close(); + Platform.Dispose(_in); } private class FullReaderStream : FilterStream |