summary refs log tree commit diff
path: root/crypto/src/security
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-27 20:10:48 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-27 20:10:48 +0700
commitee804df4e9fce47ff92a39524646c4aba0a90ddc (patch)
treecd52aa3902db7502db774b9fb7fbe1d956d765df /crypto/src/security
parentRefactoring in Bcpg.Sig (diff)
downloadBouncyCastle.NET-ed25519-ee804df4e9fce47ff92a39524646c4aba0a90ddc.tar.xz
DateTimeUtilities improvements:
- DateTimeToUnixMs converts to UTC
- UnixMsToDateTime checks input range
Diffstat (limited to 'crypto/src/security')
-rw-r--r--crypto/src/security/JksStore.cs6
1 files changed, 2 insertions, 4 deletions
diff --git a/crypto/src/security/JksStore.cs b/crypto/src/security/JksStore.cs
index 69ade11af..30b21fad2 100644
--- a/crypto/src/security/JksStore.cs
+++ b/crypto/src/security/JksStore.cs
@@ -461,8 +461,7 @@ namespace Org.BouncyCastle.Security
         private static DateTime ReadDateTime(BinaryReader br)
         {
             long unixMS = BinaryReaders.ReadInt64BigEndian(br);
-            DateTime unix = DateTimeUtilities.UnixMsToDateTime(unixMS);
-            return new DateTime(unix.Ticks, DateTimeKind.Utc);
+            return DateTimeUtilities.UnixMsToDateTime(unixMS);
         }
 
         private static X509Certificate ReadTypedCertificate(BinaryReader br, int storeVersion)
@@ -517,8 +516,7 @@ namespace Org.BouncyCastle.Security
 
         private static void WriteDateTime(BinaryWriter bw, DateTime dateTime)
         {
-            DateTime utc = dateTime.ToUniversalTime();
-            long unixMS = DateTimeUtilities.DateTimeToUnixMs(utc);
+            long unixMS = DateTimeUtilities.DateTimeToUnixMs(dateTime);
             BinaryWriters.WriteInt64BigEndian(bw, unixMS);
         }