summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/asn1/DerGeneralizedTime.cs2
-rw-r--r--crypto/src/asn1/DerUTCTime.cs2
-rw-r--r--crypto/src/asn1/x509/Time.cs2
-rw-r--r--crypto/src/bcpg/BcpgOutputStream.cs4
-rw-r--r--crypto/src/openpgp/PgpCompressedDataGenerator.cs12
-rw-r--r--crypto/src/openpgp/WrappedGeneratorStream.cs1
-rw-r--r--crypto/test/src/asn1/test/GenerationTest.cs18
-rw-r--r--crypto/test/src/asn1/test/TimeTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPRSATest.cs2
-rw-r--r--crypto/test/src/util/test/UncloseableStream.cs8
10 files changed, 31 insertions, 22 deletions
diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs
index 9a125ff3b..ceb1a4fa3 100644
--- a/crypto/src/asn1/DerGeneralizedTime.cs
+++ b/crypto/src/asn1/DerGeneralizedTime.cs
@@ -83,7 +83,7 @@ namespace Org.BouncyCastle.Asn1
         public DerGeneralizedTime(
             DateTime time)
         {
-            this.time = time.ToString(@"yyyyMMddHHmmss\Z");
+            this.time = time.ToUniversalTime().ToString(@"yyyyMMddHHmmss\Z");
         }
 
         internal DerGeneralizedTime(
diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs
index 56fabeb47..812d91db6 100644
--- a/crypto/src/asn1/DerUTCTime.cs
+++ b/crypto/src/asn1/DerUTCTime.cs
@@ -86,7 +86,7 @@ namespace Org.BouncyCastle.Asn1
         public DerUtcTime(
             DateTime time)
         {
-            this.time = time.ToString("yyMMddHHmmss") + "Z";
+            this.time = time.ToUniversalTime().ToString("yyMMddHHmmss") + "Z";
         }
 
 		internal DerUtcTime(
diff --git a/crypto/src/asn1/x509/Time.cs b/crypto/src/asn1/x509/Time.cs
index 0f2511e6d..04b4a5a65 100644
--- a/crypto/src/asn1/x509/Time.cs
+++ b/crypto/src/asn1/x509/Time.cs
@@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.X509
         public Time(
             DateTime date)
         {
-            string d = date.ToString("yyyyMMddHHmmss") + "Z";
+            string d = date.ToUniversalTime().ToString("yyyyMMddHHmmss") + "Z";
 
             int year = Int32.Parse(d.Substring(0, 4));
 
diff --git a/crypto/src/bcpg/BcpgOutputStream.cs b/crypto/src/bcpg/BcpgOutputStream.cs
index 3c25929c4..f62fadc19 100644
--- a/crypto/src/bcpg/BcpgOutputStream.cs
+++ b/crypto/src/bcpg/BcpgOutputStream.cs
@@ -384,8 +384,8 @@ namespace Org.BouncyCastle.Bcpg
 	        if (disposing)
 	        {
                 this.Finish();
-                outStr.Flush();
-           //     outStr.Dispose();
+                outStr.Flush();                
+                outStr.Dispose();
 	        }
 	       base.Dispose(disposing);
 	    }
diff --git a/crypto/src/openpgp/PgpCompressedDataGenerator.cs b/crypto/src/openpgp/PgpCompressedDataGenerator.cs
index c0035ab05..e3a889316 100644
--- a/crypto/src/openpgp/PgpCompressedDataGenerator.cs
+++ b/crypto/src/openpgp/PgpCompressedDataGenerator.cs
@@ -155,8 +155,8 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 			{
 				if (dOut != pkOut)
 				{
+                    dOut.Dispose();
                     dOut.Flush();
-					dOut.Dispose();
 				}
 
 				dOut = null;
@@ -190,7 +190,15 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 				: base(output, level, nowrap)
 			{
 			}
-		   
+
+		    protected override void Dispose(bool disposing)
+		    {
+		        if (disposing)
+		        {
+		            Finish();
+		            End();
+		        }
+		    }
 		}
 	}
 }
diff --git a/crypto/src/openpgp/WrappedGeneratorStream.cs b/crypto/src/openpgp/WrappedGeneratorStream.cs
index 3468ecfbb..e57797427 100644
--- a/crypto/src/openpgp/WrappedGeneratorStream.cs
+++ b/crypto/src/openpgp/WrappedGeneratorStream.cs
@@ -23,6 +23,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 	        {
 	            gen.Close();
 	        }
+	   //     base.Dispose(disposing);
 	    }
 	}
 }
diff --git a/crypto/test/src/asn1/test/GenerationTest.cs b/crypto/test/src/asn1/test/GenerationTest.cs
index 5acf8e149..534f76bfd 100644
--- a/crypto/test/src/asn1/test/GenerationTest.cs
+++ b/crypto/test/src/asn1/test/GenerationTest.cs
@@ -53,8 +53,8 @@ namespace Org.BouncyCastle.Asn1.Tests
         private void TbsV1CertGenerate()
         {
 			V1TbsCertificateGenerator gen = new V1TbsCertificateGenerator();
-            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1);
-            DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 12);
+            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc);
+            DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 12, DateTimeKind.Utc);
 
             gen.SetSerialNumber(new DerInteger(1));
 
@@ -106,8 +106,8 @@ namespace Org.BouncyCastle.Asn1.Tests
 		private void TbsV3CertGenerate()
         {
 			V3TbsCertificateGenerator gen = new V3TbsCertificateGenerator();
-			DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1);
-			DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 2);
+            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc);
+            DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 2, DateTimeKind.Utc);
 
 			gen.SetSerialNumber(new DerInteger(2));
 
@@ -166,8 +166,8 @@ namespace Org.BouncyCastle.Asn1.Tests
 		private void TbsV3CertGenWithNullSubject()
 		{
 			V3TbsCertificateGenerator gen = new V3TbsCertificateGenerator();
-			DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1);
-			DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 2);
+            DateTime startDate = new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc);
+            DateTime endDate = new DateTime(1970, 1, 1, 0, 0, 2, DateTimeKind.Utc);
 
 			gen.SetSerialNumber(new DerInteger(2));
 
@@ -243,11 +243,11 @@ namespace Org.BouncyCastle.Asn1.Tests
 
             gen.SetIssuer(new X509Name("CN=AU,O=Bouncy Castle"));
 
-            gen.AddCrlEntry(new DerInteger(1), new Time(new DateTime(1970, 1, 1, 0, 0, 1)), ReasonFlags.AACompromise);
+            gen.AddCrlEntry(new DerInteger(1), new Time(new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc)), ReasonFlags.AACompromise);
 
-            gen.SetNextUpdate(new Time(new DateTime(1970, 1, 1, 0, 0, 2)));
+            gen.SetNextUpdate(new Time(new DateTime(1970, 1, 1, 0, 0, 2, DateTimeKind.Utc)));
 
-            gen.SetThisUpdate(new Time(new DateTime(1970, 1, 1, 0, 0, 0, 500)));
+            gen.SetThisUpdate(new Time(new DateTime(1970, 1, 1, 0, 0, 0, 500, DateTimeKind.Utc)));
 
             gen.SetSignature(new AlgorithmIdentifier(PkcsObjectIdentifiers.Sha1WithRsaEncryption, DerNull.Instance));
 
diff --git a/crypto/test/src/asn1/test/TimeTest.cs b/crypto/test/src/asn1/test/TimeTest.cs
index 6f6bd6f2c..101a87935 100644
--- a/crypto/test/src/asn1/test/TimeTest.cs
+++ b/crypto/test/src/asn1/test/TimeTest.cs
@@ -15,7 +15,7 @@ namespace Org.BouncyCastle.Asn1.Tests
 			DateTime now = DateTime.UtcNow;
 
 			// Time classes only have a resolution of seconds
-			now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
+			now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, DateTimeKind.Utc);
 
 			Org.BouncyCastle.Asn1.Cms.Time cmsTime = new Org.BouncyCastle.Asn1.Cms.Time(now);
 			Org.BouncyCastle.Asn1.X509.Time x509Time = new Org.BouncyCastle.Asn1.X509.Time(now);
diff --git a/crypto/test/src/openpgp/test/PGPRSATest.cs b/crypto/test/src/openpgp/test/PGPRSATest.cs
index 35f844483..c14f365bf 100644
--- a/crypto/test/src/openpgp/test/PGPRSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPRSATest.cs
@@ -985,7 +985,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
             sGen.Generate().Encode(bcOut);
 
-            bcOut.Close();
+            bcOut.Dispose();
 
             //
             // verify generated signature
diff --git a/crypto/test/src/util/test/UncloseableStream.cs b/crypto/test/src/util/test/UncloseableStream.cs
index 8b592cdd4..23eab5b6a 100644
--- a/crypto/test/src/util/test/UncloseableStream.cs
+++ b/crypto/test/src/util/test/UncloseableStream.cs
@@ -14,9 +14,9 @@ namespace Org.BouncyCastle.Utilities.Test
 		{
 		}
 
-		public override void Close()
-		{
-			throw new Exception("Close() called on UncloseableStream");
-		}
+        //public override void Close()
+        //{
+        //    throw new Exception("Close() called on UncloseableStream");
+        //}
 	}
 }