diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-19 15:36:02 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-03-19 15:36:02 +0700 |
commit | b5a304895fa39de0f714332e04fb42223874a2f0 (patch) | |
tree | 403b879c6401d6509855f3fb26cde6bec4b31aa2 /crypto/src/bcpg/sig/SignatureExpirationTime.cs | |
parent | EdDSA: Explicit guard against infinite looping (diff) | |
download | BouncyCastle.NET-ed25519-b5a304895fa39de0f714332e04fb42223874a2f0.tar.xz |
Sanity checks and refactoring in Bcpg.Sig
Diffstat (limited to 'crypto/src/bcpg/sig/SignatureExpirationTime.cs')
-rw-r--r-- | crypto/src/bcpg/sig/SignatureExpirationTime.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crypto/src/bcpg/sig/SignatureExpirationTime.cs b/crypto/src/bcpg/sig/SignatureExpirationTime.cs index 44c714f33..eb2faede9 100644 --- a/crypto/src/bcpg/sig/SignatureExpirationTime.cs +++ b/crypto/src/bcpg/sig/SignatureExpirationTime.cs @@ -1,4 +1,4 @@ -using Org.BouncyCastle.Crypto.Utilities; +using System; namespace Org.BouncyCastle.Bcpg.Sig { @@ -8,10 +8,8 @@ namespace Org.BouncyCastle.Bcpg.Sig public class SignatureExpirationTime : SignatureSubpacket { - protected static byte[] TimeToBytes(long t) - { - return Pack.UInt32_To_BE((uint)t); - } + [Obsolete("Will be removed")] + protected static byte[] TimeToBytes(long t) => Utilities.TimeToBytes((uint)t); public SignatureExpirationTime(bool critical, bool isLongLength, byte[] data) : base(SignatureSubpacketTag.ExpireTime, critical, isLongLength, data) @@ -19,13 +17,13 @@ namespace Org.BouncyCastle.Bcpg.Sig } public SignatureExpirationTime(bool critical, long seconds) - : base(SignatureSubpacketTag.ExpireTime, critical, false, TimeToBytes(seconds)) + : base(SignatureSubpacketTag.ExpireTime, critical, false, Utilities.TimeToBytes((uint)seconds)) { } /** * return time in seconds before signature expires after creation time. */ - public long Time => Pack.BE_To_UInt32(data, 0); + public long Time => (long)Utilities.TimeFromBytes(data); } } |