diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-27 20:10:48 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-27 20:10:48 +0700 |
commit | ee804df4e9fce47ff92a39524646c4aba0a90ddc (patch) | |
tree | cd52aa3902db7502db774b9fb7fbe1d956d765df /crypto/src/security/JksStore.cs | |
parent | Refactoring in Bcpg.Sig (diff) | |
download | BouncyCastle.NET-ed25519-ee804df4e9fce47ff92a39524646c4aba0a90ddc.tar.xz |
DateTimeUtilities improvements:
- DateTimeToUnixMs converts to UTC - UnixMsToDateTime checks input range
Diffstat (limited to 'crypto/src/security/JksStore.cs')
-rw-r--r-- | crypto/src/security/JksStore.cs | 6 |
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); } |