summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 23:17:40 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 23:17:40 +0700
commitf5c5119255ce14081009a3dc9ccc1427c78f47a3 (patch)
tree2afd90b47aee6697b359c9e066f1e2dbfea8f678
parentUse generics in Enums (diff)
downloadBouncyCastle.NET-ed25519-f5c5119255ce14081009a3dc9ccc1427c78f47a3.tar.xz
Remove Times class
-rw-r--r--crypto/src/security/SecureRandom.cs3
-rw-r--r--crypto/src/tls/AbstractTlsContext.cs4
-rw-r--r--crypto/src/util/Times.cs14
3 files changed, 3 insertions, 18 deletions
diff --git a/crypto/src/security/SecureRandom.cs b/crypto/src/security/SecureRandom.cs
index 4e118e77a..0ab33c4c6 100644
--- a/crypto/src/security/SecureRandom.cs
+++ b/crypto/src/security/SecureRandom.cs
@@ -4,14 +4,13 @@ using System.Threading;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Prng;
 using Org.BouncyCastle.Crypto.Utilities;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Security
 {
     public class SecureRandom
         : Random
     {
-        private static long counter = Times.NanoTime();
+        private static long counter = DateTime.UtcNow.Ticks;
 
         private static long NextCounterValue()
         {
diff --git a/crypto/src/tls/AbstractTlsContext.cs b/crypto/src/tls/AbstractTlsContext.cs
index a5ac85962..40a8e8f75 100644
--- a/crypto/src/tls/AbstractTlsContext.cs
+++ b/crypto/src/tls/AbstractTlsContext.cs
@@ -11,7 +11,7 @@ namespace Org.BouncyCastle.Tls
     internal abstract class AbstractTlsContext
         : TlsContext
     {
-        private static long counter = Times.NanoTime();
+        private static long counter = DateTime.UtcNow.Ticks;
 
         private static long NextCounterValue()
         {
@@ -22,7 +22,7 @@ namespace Org.BouncyCastle.Tls
         {
             byte[] additionalSeedMaterial = new byte[16];
             Pack.UInt64_To_BE((ulong)NextCounterValue(), additionalSeedMaterial, 0);
-            Pack.UInt64_To_BE((ulong)Times.NanoTime(), additionalSeedMaterial, 8);
+            Pack.UInt64_To_BE((ulong)DateTime.UtcNow.Ticks, additionalSeedMaterial, 8);
             additionalSeedMaterial[0] &= 0x7F;
             additionalSeedMaterial[0] |= (byte)(connectionEnd << 7);
 
diff --git a/crypto/src/util/Times.cs b/crypto/src/util/Times.cs
deleted file mode 100644
index 99a78d21a..000000000
--- a/crypto/src/util/Times.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace Org.BouncyCastle.Utilities
-{
-    public sealed class Times
-    {
-        private static long NanosecondsPerTick = 100L;
-
-        public static long NanoTime()
-        {
-            return DateTime.UtcNow.Ticks * NanosecondsPerTick;
-        }
-    }
-}