diff --git a/src/Cask/Cask.cs b/src/Cask/Cask.cs index 958725a..49ccd68 100644 --- a/src/Cask/Cask.cs +++ b/src/Cask/Cask.cs @@ -194,10 +194,10 @@ private static void FinalizeKey(Span key, ValidateTimestamp(now); ReadOnlySpan chars = [ Base64UrlChars[now.Year - 2024], // Years since 2024. - Base64UrlChars[now.Month - 1], // Zero-indexed month. - Base64UrlChars[now.Day - 1], // Zero-indexed day. - Base64UrlChars[now.Hour], // Zero-indexed hour. - ]; + Base64UrlChars[now.Month - 1], // Zero-indexed month. + Base64UrlChars[now.Day - 1], // Zero-indexed day. + Base64UrlChars[now.Hour], // Zero-indexed hour. + ]; bytesWritten = Base64Url.DecodeFromChars(chars, key[YearMonthHoursDaysTimestampByteRange]); Debug.Assert(bytesWritten == 3); @@ -207,10 +207,10 @@ private static void FinalizeKey(Span key, chars = [ Base64UrlChars[now.Minute], // Zero-indexed minute. - expiryChars[0], - expiryChars[1], - expiryChars[2], - ]; + expiryChars[0], + expiryChars[1], + expiryChars[2], + ]; bytesWritten = Base64Url.DecodeFromChars(chars, key[MinutesAndExpiryByteRange]); Debug.Assert(bytesWritten == 3); diff --git a/src/Cask/Helpers.cs b/src/Cask/Helpers.cs index 59bdbd9..9cec69b 100644 --- a/src/Cask/Helpers.cs +++ b/src/Cask/Helpers.cs @@ -53,15 +53,6 @@ public static int GetKeyLengthInBytes(int providerDataLengthInBytes) return keyLengthInBytes; } - public static int GetHashLengthInBytes(int secretSizeInBytes) - { - int hashLengthInBytes = PaddedHmacSha256SizeInBytes + secretSizeInBytes; - Debug.Assert(Is3ByteAligned(secretSizeInBytes)); - Debug.Assert(Is3ByteAligned(hashLengthInBytes)); - return hashLengthInBytes; - } - - public static SensitiveDataSize CharToSensitiveDataSize(char sensitiveDataSizeChar) { return (SensitiveDataSize)(sensitiveDataSizeChar - 'A'); ; diff --git a/src/Cask/Limits.cs b/src/Cask/Limits.cs index 1dbc1e7..4c1fa76 100644 --- a/src/Cask/Limits.cs +++ b/src/Cask/Limits.cs @@ -26,22 +26,22 @@ public static class Limits public static int MaxProviderDataLengthInChars { get; } = BytesToBase64Chars(MaxProviderDataLengthInBytes); /// - /// The minimum length of a Cask key or hash when decoded to bytes. + /// The minimum length of a Cask secret when decoded to bytes. /// public static int MinKeyLengthInBytes { get; } = GetKeyLengthInBytes(0); /// - /// The maximum length of a Cask key or hash when decoded to bytes. + /// The maximum length of a Cask secret when decoded to bytes. /// - public static int MaxKeyLengthInBytes { get; } = GetHashLengthInBytes(GetKeyLengthInBytes(MaxProviderDataLengthInBytes) - 33); + public static int MaxKeyLengthInBytes { get; } = GetKeyLengthInBytes(MaxProviderDataLengthInBytes); /// - /// The minimum length of a Cask key in characters. + /// The minimum length of a Cask secret in characters. /// public static int MinKeyLengthInChars { get; } = BytesToBase64Chars(MinKeyLengthInBytes); /// - /// The maximum length of a Cask key in characters. + /// The maximum length of a Cask secret in characters. /// public static int MaxKeyLengthInChars { get; } = BytesToBase64Chars(MaxKeyLengthInBytes);