summary refs log tree commit diff
path: root/crypto/src/bcpg
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/bcpg
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/bcpg')
-rw-r--r--crypto/src/bcpg/SignaturePacket.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/src/bcpg/SignaturePacket.cs b/crypto/src/bcpg/SignaturePacket.cs
index 3256ee35e..dd9cc78e3 100644
--- a/crypto/src/bcpg/SignaturePacket.cs
+++ b/crypto/src/bcpg/SignaturePacket.cs
@@ -237,7 +237,7 @@ namespace Org.BouncyCastle.Bcpg
 
 			if (hashedData != null)
 			{
-				setCreationTime();
+				SetCreationTime();
 			}
 		}
 
@@ -446,18 +446,18 @@ namespace Org.BouncyCastle.Bcpg
 			return sOut.ToArray();
 		}
 
-		private void setCreationTime()
+		private void SetCreationTime()
 		{
 			foreach (SignatureSubpacket p in hashedData)
 			{
-				if (p is SignatureCreationTime)
+				if (p is SignatureCreationTime signatureCreationTime)
 				{
-                    creationTime = DateTimeUtilities.DateTimeToUnixMs(
-						((SignatureCreationTime)p).GetTime());
+                    creationTime = DateTimeUtilities.DateTimeToUnixMs(signatureCreationTime.GetTime());
 					break;
 				}
 			}
 		}
+
         public static SignaturePacket FromByteArray(byte[] data)
         {
             BcpgInputStream input = BcpgInputStream.Wrap(new MemoryStream(data));